Access-Excel Automation

  • Thread starter Thread starter Rafi
  • Start date Start date
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
 
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
 
Back
Top