Automation error when running phstat in excel 2016
#AUTOMATION ERROR WHEN RUNNING PHSTAT IN EXCEL 2016 CODE#
However, if the Visual Basic code is part of an add-in, the ThisWorkbook property. In most cases, this is the same as the active workbook. The ThisWorkbook property of the Application object returns the workbook where the Visual Basic code is running. I have modified the program and my new coding is Sub ReadDB()Ĭonnection.ConnectionString = "DSN=sgdv UID=l8qc1 PWD=l8qc1 " The Workbooks collection contains all the Workbook objects currently open in Microsoft Excel.
MainWorkBook.Sheets("Sheet2").Range("A" & intRowCounter).Value = resultSet.Fields("DEDICT01.CUST_PARTS_NO").Value Set resultSet = Connection.Execute(strQuery) StrQuery = "SELECT * FROM DEDICT01 where DEDICT01.SER_SN='Z1E80R4C'" Set Connection = CreateObject("ADODB.Connection") Chose any file name and location, but keep the file type as. For safety, make a backup copy of this entry, by right-clicking Options and selecting Export. My code uses Excel dll for generation of dynamic excel file. The lessons in this module are organized around several. Under Office, navigate to 12.0ExcelOptions for Excel 2007, 14.0ExcelOptions for Excel 2010, 15.0ExcelOptions for Excel 2013, or 16.0ExcelOptions for Excel 2016. I have a ASP.NET MVC project which using Microsoft Excel library i.e ( version: 15.0.0.0). I am trying to query the data from the database but the VBA shows the error as below for the line Connection.Open "DSN=sgdv". Video created by - for the course 'Introduction to Accounting Data Analytics and Visualization'. I am trying to run Excel macro to query some data from my ODBC database.ĭSN: sgdv UID: l8qc1 Password: l8qc1 server: sgdv