Access-Excel Automation

R

Rafi

I have the following code which works fine however, I need to add a feature
that will return an acknowledgment to Access that the Excel code (DHL.DHL)
actually ran suiccessfully.

Private Sub Cmd1_Click() 'Convert Vista.xml
Dim XL As Object
If XL Is Nothing Then
Set XL = CreateObject("Excel.Application")

XL.Workbooks.Open strUser & "\Application
Data\Microsoft\Excel\XLSTART\PERSONAL.XLS"

End If
XL.Run "PERSONAL.XLS!DHL.DHL"
MsgBox "File conversion Completed"
XL.Workbooks.Close
XL.Quit
End Sub
 
A

Alex Dybenko

Hi,
The Run method returns whatever the called macro returns.
so make sure that your DHL.DHL returns something, then you can get this
like:

MsgBox "File conversion Completed: " & XL.Run("PERSONAL.XLS!DHL.DHL")

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top