tebule
10-10-2007, 01:48 PM
:banghead:
O.K. I have been working on this for a few hours so here is my problem:
I created an application that imports .csv file information and then outputs an excel document. That last part is where I am having the trouble. I create an excel document using:
DoCmd.OutputTo acOutputQuery, "Output_NoNAIC", acFormatXLS, _
strMonthlyFileCompPath, True
The true swith on the code above opens an instance of excel with my new workbook. What I am trying to do is set an object to my new workbook so I can format my output. I have tried:
Dim objXL As Excel.Application
'AppActivate "Microsoft Excel"
Set objXL = GetObject(strPathName, Excel.Application)
' When Window Name stored in variable can then activate by
' this function.
' Example below:
''Set objXL = Excel.Application
'Application.Workbooks.Worksheets(1).Visible = _
'DLookup("ShowExcel", "tblControls")
And a few other things that I have deleted. From what I am reading, I should be able to use the GetObject function. The commented out lines are the ones that I tried and gave up on. Any help is greatly appriciated. If I don't figure this out I will have to turn off the switch and use the createobject function. I would rather learn the getobject function instead.:wot
And If I have to use an API, how do I declair them?
Any help appricated!
Thanks,
Bre
O.K. I have been working on this for a few hours so here is my problem:
I created an application that imports .csv file information and then outputs an excel document. That last part is where I am having the trouble. I create an excel document using:
DoCmd.OutputTo acOutputQuery, "Output_NoNAIC", acFormatXLS, _
strMonthlyFileCompPath, True
The true swith on the code above opens an instance of excel with my new workbook. What I am trying to do is set an object to my new workbook so I can format my output. I have tried:
Dim objXL As Excel.Application
'AppActivate "Microsoft Excel"
Set objXL = GetObject(strPathName, Excel.Application)
' When Window Name stored in variable can then activate by
' this function.
' Example below:
''Set objXL = Excel.Application
'Application.Workbooks.Worksheets(1).Visible = _
'DLookup("ShowExcel", "tblControls")
And a few other things that I have deleted. From what I am reading, I should be able to use the GetObject function. The commented out lines are the ones that I tried and gave up on. Any help is greatly appriciated. If I don't figure this out I will have to turn off the switch and use the createobject function. I would rather learn the getobject function instead.:wot
And If I have to use an API, how do I declair them?
Any help appricated!
Thanks,
Bre