I have a problem with my coding when wants to move all the data to the second worksheet. I try to change the setting to make the output in 2nd worksheet, but it didnt work.
this is my code:
VB Code:
Set objExcel = CreateObject("excel.application") 'Starts the Excel Session Set objBook = objExcel.Workbooks.Add 'Add a Workbook Set objSheet = objBook.Worksheets.Item(1) 'Select a Sheet objExcel.Application.Visible = True objExcel.Application.Cells(1, 1).Value = "Kod Kategori BA" objExcel.Application.Cells(1, 2).Value = "No.BA" With objExcel .Application.Cells(n, 1).Value = ((Trim(DataHRMIS.Recordset.Fields("BACatCd").Value))) .Application.Cells(n, 2).Value = ((Trim(DataHRMIS.Recordset.Fields("BANo").Value))) end with
i try to change here, but it still dont work!
VB Code:
Set objSheet = objBook.Worksheets.Item(2)
how can i fix this? anyone plz help me...tq




Reply With Quote