I am trying to create an Excel file from a macro in MS OUTLOOK using basically the following code:
Dim objXL As Object
Dim objWB As Object
Dim sXLSFile As String
'Create excel object
Set objXL = CreateObject("Excel.Application")
'Open existing workbook
sXLSFile = "c:\ee\shrink.xls"
Set objWB = objXL.Workbooks.Open(sXLSFile)
But I get an error saying file is not found. Do I have to create a blank file of that name manually before I run the code? Also when i try to save the file using objXL.GetSaveAsFilename, the file gets locked and I cannot run the macro again.
Finally, my macro only runs if I leave out the words "As Object" in the Dim statements above. Please help
Dim objXL As Object
Dim objWB As Object
Dim sXLSFile As String
'Create excel object
Set objXL = CreateObject("Excel.Application")
'Open existing workbook
sXLSFile = "c:\ee\shrink.xls"
Set objWB = objXL.Workbooks.Open(sXLSFile)
But I get an error saying file is not found. Do I have to create a blank file of that name manually before I run the code? Also when i try to save the file using objXL.GetSaveAsFilename, the file gets locked and I cannot run the macro again.
Finally, my macro only runs if I leave out the words "As Object" in the Dim statements above. Please help