N
neerak via AccessMonster.com
i'm having trouble deleting excel worksheets from access. I've tried all
four methods below but none of them seem to work.
Set xlApp = CreateObject("excel.application")
Set xlWkBk = xlApp.workbooks.Open(CurrentProject.Path & "\" & strFilename)
xlApp.UserControl = True
xlApp.sheets("Sheet1").select <------- first method
xlApp.activewindow.selectedsheets.Delete
xlApp.worksheets(strReportName).Delete <------- second method
xlapp.worksheets("Sheet1").select <------- third method
xlapp.activewindow.selectedsheets.delete
xlApp.sheets("Sheet1").delete <------ fourth method
Set db = Nothing
Set rst = Nothing
Set xlApp = Nothing
Set xlWkBk = Nothing
Set xlWkSh = Nothing
xlApp.Visible = True
four methods below but none of them seem to work.
Set xlApp = CreateObject("excel.application")
Set xlWkBk = xlApp.workbooks.Open(CurrentProject.Path & "\" & strFilename)
xlApp.UserControl = True
xlApp.sheets("Sheet1").select <------- first method
xlApp.activewindow.selectedsheets.Delete
xlApp.worksheets(strReportName).Delete <------- second method
xlapp.worksheets("Sheet1").select <------- third method
xlapp.activewindow.selectedsheets.delete
xlApp.sheets("Sheet1").delete <------ fourth method
Set db = Nothing
Set rst = Nothing
Set xlApp = Nothing
Set xlWkBk = Nothing
Set xlWkSh = Nothing
xlApp.Visible = True