Exporting to Excel

  • Thread starter Thread starter Guest
  • Start date Start date
Here is the code how to mention the sheet name while transfering data to Excel.

Dim objXL As Excel.Application
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet

Dim rst As Recordset

Dim iRow As Integer

'--- open the workbook
Set objXL = New Excel.Application
objXL.Visible = True
Set objWkb = objXL.Workbooks.Open("D:\MyProjects\MaterialList.xls")

'Here to mention the sheet name
Set objSht = objWkb.Worksheets("Sheet1")

' Further code lines..

Hope this helps

Ashfaque
 
Last edited:
Back
Top