Here is some sample code Ive pieced together from other posts on this site. It takes a file C:\Kk.xls, puts in useful data, and saves it as anything I want.
I dont need there to be a Kk file, Id like to just create an excel file and then save it. I also dont need any dialog boxes prompting the user, so the below code is appropriate:
I dont need there to be a Kk file, Id like to just create an excel file and then save it. I also dont need any dialog boxes prompting the user, so the below code is appropriate:
Code:
Dim xlApp As Excel.Application
Dim xlMappe As Excel.Workbook
Dim xlZelle As Excel.Range
xlApp = New Excel.Application()
xlMappe = New Excel.Workbook()
xlMappe = xlApp.Workbooks.Open("C:\Kk.xls")
I dont want there to have to be Kk. Id just like to create a new workbook, not sure how to do this.
xlZelle = xlMappe.Worksheets(1).Range("A1")
xlZelle.Value = "whatever data I want"
Dim blah as String
blah = "C:\Whatever_File_I_want.xls"
xlMappe.SaveAs(blah)
xlApp.Quit()
xlZelle = Nothing
xlMappe = Nothing
xlApp = Nothing
Last edited by a moderator: