R
RzB
I have the following , very simple code to create/close
an excel spreadsheet. After executing this code I was
expecting to be able to open the spreadsheet manually.
However I can only do this if I first close the Access
db that this code is running in. I have spent all day
reading and re reading posts and KB Articles but still
can't get it to work. I have seen one post that indicates
using a Win API call as a last resort.
I am using Win XP Pro and Access/Excel 2002.
Is my code ok? Or am I doing summat wrong?
Dim objXlApp As Excel.Application
Dim objXlWkb As Excel.Workbook
Dim objXlSht As Excel.Worksheet
Set objXlApp = New Excel.Application
Set objXlWkb = objXlApp.Workbooks.Add
Set objXlSht = objXlWkb.Worksheets("Sheet1")
objXlSht.Range("A1") = "HelloWorld"
objXlWkb.SaveAs ("C:\Maplspreadsheets\RzB.xls")
objXlWkb.Close
objXlApp.Quit
Set objXlSht = Nothing
Set objXlWkb = Nothing
Set objXlApp = Nothing
Thanks,
Roy
an excel spreadsheet. After executing this code I was
expecting to be able to open the spreadsheet manually.
However I can only do this if I first close the Access
db that this code is running in. I have spent all day
reading and re reading posts and KB Articles but still
can't get it to work. I have seen one post that indicates
using a Win API call as a last resort.
I am using Win XP Pro and Access/Excel 2002.
Is my code ok? Or am I doing summat wrong?
Dim objXlApp As Excel.Application
Dim objXlWkb As Excel.Workbook
Dim objXlSht As Excel.Worksheet
Set objXlApp = New Excel.Application
Set objXlWkb = objXlApp.Workbooks.Add
Set objXlSht = objXlWkb.Worksheets("Sheet1")
objXlSht.Range("A1") = "HelloWorld"
objXlWkb.SaveAs ("C:\Maplspreadsheets\RzB.xls")
objXlWkb.Close
objXlApp.Quit
Set objXlSht = Nothing
Set objXlWkb = Nothing
Set objXlApp = Nothing
Thanks,
Roy