VB 6.0 and excel 2k interaction.
-
I have written 1 app which creates new excel workbook and writes into it.But ,I was not able to do so with existing excel workbook. How should I open existing excel sheet in vb6.0 ? I want to write data into workbook having macros. should I use MS excel driver ? Thanks, Amit
-
I have written 1 app which creates new excel workbook and writes into it.But ,I was not able to do so with existing excel workbook. How should I open existing excel sheet in vb6.0 ? I want to write data into workbook having macros. should I use MS excel driver ? Thanks, Amit
Hello, Try the next code: ' Variables... Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet ' Excel, Book and Sheet instantiation... Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.Workbooks.Open(App.Path & "\Book1.xls") Set xlSheet = xlBook.Worksheets(1) With that code you can access to a existing sheet in a XLS file. The DLL you have to use is 'Microsoft Excel XX Library' (in the references section of VB6). Bye.
-
Hello, Try the next code: ' Variables... Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet ' Excel, Book and Sheet instantiation... Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.Workbooks.Open(App.Path & "\Book1.xls") Set xlSheet = xlBook.Worksheets(1) With that code you can access to a existing sheet in a XLS file. The DLL you have to use is 'Microsoft Excel XX Library' (in the references section of VB6). Bye.