JoanaSantos
Programmer
Hi, I have created this code to save the info of one table in excel :
but in the end i stay with two sheets: sheet1 and F01Incos01. Can u help me? i just want to stay with the sheet "F01Incos01"
Private Sub Command329_Click()
Dim newExcelApp As Excel.Application
Dim newWbk As Excel.Workbook
Dim newWkSheet As Excel.Worksheet
Set newExcelApp = Excel.Application
'Set newExcelApp.Visible = True
Set newWbk = newExcelApp.Workbooks.Add(xlWBATWorksheet)
'Set newWkSheet = newWbk.Worksheets(1)
newWbk.SaveAs "C:\Joana\F01Incos01.xlsx"
strExcelPath = "C:\Joana\F01Incos01.xlsx"
newWbk.Save
newWbk.Close
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"F01Incos01", strExcelPath, True
DoCmd.SetWarnings True
MsgBox "Processo Concluído!"
End Sub
but in the end i stay with two sheets: sheet1 and F01Incos01. Can u help me? i just want to stay with the sheet "F01Incos01"
Private Sub Command329_Click()
Dim newExcelApp As Excel.Application
Dim newWbk As Excel.Workbook
Dim newWkSheet As Excel.Worksheet
Set newExcelApp = Excel.Application
'Set newExcelApp.Visible = True
Set newWbk = newExcelApp.Workbooks.Add(xlWBATWorksheet)
'Set newWkSheet = newWbk.Worksheets(1)
newWbk.SaveAs "C:\Joana\F01Incos01.xlsx"
strExcelPath = "C:\Joana\F01Incos01.xlsx"
newWbk.Save
newWbk.Close
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"F01Incos01", strExcelPath, True
DoCmd.SetWarnings True
MsgBox "Processo Concluído!"
End Sub