Start Excelmakros inside Access

L

Lars

13:44 2007-03-07

Hi,
Is there some help in cyber space...
to deploy a Access file including a autom. Excel start
If I include a Reference inside the AccessModule like Ms Excel 9 object lib
"EXCEL9.OLB"
I works just fine at this very computer , but I want this to bee possible
from every Pc that will start the Accesss application
I got an error message when try to load the reference to Excel module "9.olb

Checking Help function says""
-----------------""-------------"-----------------------------
Option Compare Database
' Reference Object, References Collection Example
' The following example creates a reference to a specified type library:
'Function ReferenceFromFile(strFileName As String) As Boolean
' Dim ref As Reference
' On Error GoTo Error_ReferenceFromFile
' Set ref = References.AddFromFile(strFileName)
' ReferenceFromFile = True
'End Function
_____________________________________________________________________
And my attempt look like this
______________________________________________________________________
This part starts with a macro inside Access Run code with argument
Run code ReferenceFromFile (strFileName As String) inside the makro editor
of Access
' ----------------------------------------------------------------------

' "And here comes the Module1 inside Access that will start my Excel makro
but first teh Ref must be loaded"
'-------------------------------------------------------------------------------
Function ReferenceFromFile(strFileName As String) As Boolean
Dim ref As Reference
' Set ref = References.AddFromFile(strFileName)
Set ref = References.AddFromFile("C:\Program\Microsoft Office
2000\Office\EXCEL9.OLB")
ReferenceFromFile = True
End Function
___________________________________________________________________
' ----------------------------------------------------------------------
' This part starts with a macro inside Access Run code with argument
' Run code TjnstPLN() inside the makro editor of Access
' ----------------------------------------------------------------------
Function TjnstPLN()
Call MsgBox("Are you sure to run this Macro")
'-------------------------------------------------------------------------------
' I guess The Object to start autom. Excel ist not loaded and the Error
mess comes
'------------------------------------------------------------------------------- Dim XL As Excel.Workbook Set XL = GetObject("X:\SamlKursgMakron.xls", "Excel.sheet") XL.Application.Visible = TrueXL.Application.Windows("SamlKursgMakron.xls").Visible = TrueXL.Application.Run "Tj_0708"End Function______________________________________________________________________
 

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