C
Carl Rapson
I have an Excel spreadsheet that I am opening from within Access:
Dim xl As Excel.Application
Dim wrk As Excel.Workbook
Set xl = New Excel.Application
Set wrk = xl.Workbooks.Open(Filename:="file.xls")
I would like to call a routine within the Excel file after opening it (I
want to set up a commandbar depending on how and where Excel is opening from
my database application). However, I can't figure out where to put such a
routine so that it is accessible. I tried putting a Public Sub into a module
file, then calling it like:
wrk.MySub "param"
However, when I did this I got a run-time error 438: "Object doesn't support
this property or method".
Is it possible to do something like this? If so, where do I need to put the
sub to make it accessible? If not, is there some other way to do what I
want?
Thanks for any information,
Carl Rapson
Dim xl As Excel.Application
Dim wrk As Excel.Workbook
Set xl = New Excel.Application
Set wrk = xl.Workbooks.Open(Filename:="file.xls")
I would like to call a routine within the Excel file after opening it (I
want to set up a commandbar depending on how and where Excel is opening from
my database application). However, I can't figure out where to put such a
routine so that it is accessible. I tried putting a Public Sub into a module
file, then calling it like:
wrk.MySub "param"
However, when I did this I got a run-time error 438: "Object doesn't support
this property or method".
Is it possible to do something like this? If so, where do I need to put the
sub to make it accessible? If not, is there some other way to do what I
want?
Thanks for any information,
Carl Rapson