Hi,
I would like to do the following: create a new excel file write codes in it and after that save it with a given name but without being asked to saved it.
I wrote the following code, but at the line xlbook.save() it gives me an error that this method is not an option.
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
xlSheet.Cells(1, 1).Value = lbnr.Caption
....
'Save the Worksheet.
'xlSheet.SaveAs ("C:\" & lbnr.Caption)
xlBook.Saved = True
xlBook.Save ("C:\" & lbnr.Caption)
' Close the Workbook
xlBook.Close
' Close Microsoft Excel with the Quit method.
xlApp.Quit
' Release the objects.
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
Please responde if you have any suggestion.
Thank's
Kenguru
I would like to do the following: create a new excel file write codes in it and after that save it with a given name but without being asked to saved it.
I wrote the following code, but at the line xlbook.save() it gives me an error that this method is not an option.
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
xlSheet.Cells(1, 1).Value = lbnr.Caption
....
'Save the Worksheet.
'xlSheet.SaveAs ("C:\" & lbnr.Caption)
xlBook.Saved = True
xlBook.Save ("C:\" & lbnr.Caption)
' Close the Workbook
xlBook.Close
' Close Microsoft Excel with the Quit method.
xlApp.Quit
' Release the objects.
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
Please responde if you have any suggestion.
Thank's
Kenguru