
Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
>I have a form the opens an Excel file by use of a filedialog object. Excel
>opens up, the file is opened also. some formatting is performed and the
[quoted text clipped - 41 lines]
>
> ExcelApp.Visible = False
Yes,... I do like that code better then fileDialog. Cleanly return a
string. What is ahtAddfilterItem() & ahtCommonFileOpenSave(). There is no
reference to these functions in access/help. which library? What is the
meaning of life.... so many questions..
Also, I do need to open Excel. I receive a CSV file from a retailer that
need to be parse and cleaned up prior to importing/appending into a table.
I had originally wrote the procedures in Excel. So I would open up excel,
run the macros save the file, open access and import the file.
I moved all my code over into Access, but still need to open excel thru
automation so I can process the file. My question is this, if I do open
excel with the code:
Set obj = CreateObject("Excel.Application")
is there a way to close Excel down when I am through with the file?
> Scrap all that Excel stuff, and use the code in
> http://www.mvps.org/access/api/api0001.htm to give you the file dialog.
[quoted text clipped - 49 lines]
>>
>> ExcelApp.Visible = False
Douglas J. Steele - 30 Nov 2006 11:43 GMT
ahtAddfilterItem() & ahtCommonFileOpenSave() are functions within the code
presented on that page.
You need to copy everything in the shaded area (between Code Start and Code
End) into a new module and save that module (make sure you don't name the
module the same as any of the routines within it.) Once you've done that,
the 2 or 3 line example at the top of the page is all you need to invoke the
dialog.
The other article to which I pointed you has the code for dealing with
Excel. You haven't shown me enough of your code. In a nutshell, you need:
obj.Application.Quit
Set obj = Nothing
but you have to make sure that you've closed any open workbooks before you
can do that. If all you've done is open the one workbook, you should be able
to do that using
obj.Workbooks(1).Close SaveChange:=False
(or =True if you want changes to be saved)

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Yes,... I do like that code better then fileDialog. Cleanly return a
> string. What is ahtAddfilterItem() & ahtCommonFileOpenSave(). There is
[quoted text clipped - 66 lines]
>>>
>>> ExcelApp.Visible = False