T
tjh
Hello,
I would like to run an Excel vba Add-In macro (procedure) from Access vba
code.
- Currently, from Excel, I begin the Excel VBA code which opens a Access Form.
- The form opens other forms depending on the users input.
- When the user makes a selection on one of the final forms, I want the
Excel VBA code to continue running.
- I have set it up as a new procedure in the Excel VBA Add-In, but I am not
sure how to tell Excel to continue with this procedure from Access. At least
not successfully.
I found some code from Dev Ashish on his MVP site, but am having difficulty
making it work. Any thoughts???????
Thank You,
The fosusername() code below references the individuals userID.
The code is below:
'************* Code Start ****************
'This code was originally written by Dev Ashish
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Dev Ashish
'
Sub sRunCARMa()
Dim objXL As Object, x
On Error Resume Next
Set objXL = CreateObject("Excel.Application")
With objXL.Application
.Visible = True
'Open the Workbook
.Workbook.Open "C:\Documents and Settings\" & fOSUserName() &
"\Application Data\Microsoft\AddIns\Various Reports.XLA"
'Include CARMA in menu, run AutoOpen
'.ActiveWorkbook.RunAutoMacros xlAutoOpen
Application.Run ("XLstarts151")
End With
Set objXL = Nothing
End Sub
'************* Code End ****************
I would like to run an Excel vba Add-In macro (procedure) from Access vba
code.
- Currently, from Excel, I begin the Excel VBA code which opens a Access Form.
- The form opens other forms depending on the users input.
- When the user makes a selection on one of the final forms, I want the
Excel VBA code to continue running.
- I have set it up as a new procedure in the Excel VBA Add-In, but I am not
sure how to tell Excel to continue with this procedure from Access. At least
not successfully.
I found some code from Dev Ashish on his MVP site, but am having difficulty
making it work. Any thoughts???????
Thank You,
The fosusername() code below references the individuals userID.
The code is below:
'************* Code Start ****************
'This code was originally written by Dev Ashish
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code Courtesy of
'Dev Ashish
'
Sub sRunCARMa()
Dim objXL As Object, x
On Error Resume Next
Set objXL = CreateObject("Excel.Application")
With objXL.Application
.Visible = True
'Open the Workbook
.Workbook.Open "C:\Documents and Settings\" & fOSUserName() &
"\Application Data\Microsoft\AddIns\Various Reports.XLA"
'Include CARMA in menu, run AutoOpen
'.ActiveWorkbook.RunAutoMacros xlAutoOpen
Application.Run ("XLstarts151")
End With
Set objXL = Nothing
End Sub
'************* Code End ****************