I am a total VBA noobie and have been forced to learn it this week. I love the challenge, but am at a point where my brain is fried and I am totally stumped.
I have my form that outputs to excel. The spreadsheet is then formatted within access using some excel automation stuff. The logic I am assuming is that I can output the data to a file then open up the file and have access format it. I would like the end-user to be able to define the name of the spreadsheet and have my code make the automation changes that I have coded.
Can anyone help me out? Here is a snippet of my code:
Dim stDocName As String
stDocName = "FormG037GMth"
DoCmd.OutputTo acForm, stDocName, acFormatXLS
Set ExcelApp = CreateObject("Excel.Application")
With ExcelApp.Application
.Visible = False
.Workbooks.Open CurrentProject.Path & "\FormG037GMth.xls"
.Worksheets.Add
.Worksheets("Sheet1").Activate
'excel formatting code
I have my form that outputs to excel. The spreadsheet is then formatted within access using some excel automation stuff. The logic I am assuming is that I can output the data to a file then open up the file and have access format it. I would like the end-user to be able to define the name of the spreadsheet and have my code make the automation changes that I have coded.
Can anyone help me out? Here is a snippet of my code:
Dim stDocName As String
stDocName = "FormG037GMth"
DoCmd.OutputTo acForm, stDocName, acFormatXLS
Set ExcelApp = CreateObject("Excel.Application")
With ExcelApp.Application
.Visible = False
.Workbooks.Open CurrentProject.Path & "\FormG037GMth.xls"
.Worksheets.Add
.Worksheets("Sheet1").Activate
'excel formatting code