By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,345 Members | 1,668 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,345 IT Pros & Developers. It's quick & easy.

calling Excel xla from Access

P: n/a
I have a big ugly program in Excel that I'm trying to remake in
Access. I'm not very good at either program I'm afraid.

Right now I'm trying to call up the xla file that holds the code in
Excel and borrow a lengthy procedure from it. I can't seem to get the
xla file to load when I open the Excel workbook. Any ideas?

Here's the Access code:
Private Sub comRetrieveTracker_Click()
On Error GoTo Err_comRetrieveTracker_Click

Dim oApp As Object
Dim fullpathName As String
Dim FilenameExcel As String
Dim AddinNameExcel As String
Dim Wbk As Excel.Workbook
Dim rng As Excel.Range
Dim addinxla As Excel.AddIn
Dim PasswordExcel As String

fullpathName = "S:\PPS\"
PasswordExcel = "bonny"
FilenameExcel = "Audit_results.xls"
AddinNameExcel = "Audit macros.xla"

'Open Excel
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
On Error Resume Next
'Open Excel file with password
Wbk = oApp.Workbooks.Open(fullpathName & FilenameExcel, , _
True, , PasswordExcel)
'Activate my worksheet
oApp.Worksheets("Center work audit summary").Activate
'Here's the problem. I'm opening the addin from a network drive
'and telling Excel not to save it to the local library.
oApp.Addins.Add(fullpathName & AddinNameExcel, _
False).Installed = True
'Here's the macro I'm trying to get to:
oApp.Run ("addinxla!Enter_TrackerInfo")

'Close out excel
Set Wbk = Nothing
Set oApp = Nothing

Exit Sub

MsgBox Err.Description
Resume Exit_comRetrieveTracker_Click

End Sub

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.