Run Excel Addin

T

tjh

Hello,

I am trying to run an Excel custom Add-in from Access. The code below is
what I have put together with a few references to various posts here and from
an MVPs website, but it doesn't work. The add-in filename is "Various
Reports", and the actual procedure is called "XLstarts151"

Ultimate Goal: The user will open a blank workbook in Excel -- Hit a custom
made toolbar button (referenced to an Excel VBA Add-In) which will then open
an Access Form -- based on the users inputs, other Access forms will open --
when the user gets to one of the final access forms the data will be
transfered to Excel. My problem is that when the Excel Fires off the Access
forms, the Excel code does not know to pause and wait for the data from the
final access form -- instead it starts to run when the second form is
initialized. With this problem, I thought the best solution may be to have
the last access form restart the Excel procedure (which will be a separte
procedure from the initial Excel procedure, but stored in the same Add-in).
How can I run this procedure? Please let me know if you need more information.

Thank You,



Sub sRunXL()

Dim objXL As Object, x
Dim xlBook1 As Object
On Error Resume Next
Set objXL = CreateObject("Excel.Application")
Set xlBook1 = objXL.Workbooks.Open(objXL.LibraryPath & "Various
Reports.XLA")

objXL.Run ("XLstarts151")
xlBook1.Close
objXL.Quit
Set objXL = Nothing
Set xlBook1 = Nothing
End Sub
 
Top