hmm..
xlXP is more forgiving... i've checked in xl97 and it runs flawlessly.
A reference to extensibility is not needed.
I (and the code) assume that MTSTUFF contains a module named "Module1"
Hope you dont have a Password on your VBA code?????
Check macrosecurity/ trusted sources : Trust access to
VB project
Included a DoEvents..
I dont know which events mtstuff is running on opening (which should be
no problem, but you could insert a few debug.print lines to see who does
what in which sequence....
Sub EditMT()
Dim wkb As Workbook
Const csPath = "c:\path"
Const csName = "mtstuff.xls"
On Error Resume Next
Set wkb = Workbooks(csName)
On Error GoTo 0
If wkb Is Nothing Then
Set wkb = Workbooks.Open(csPath & csName)
End If
Do Events
wkb.VBProject.VBComponents("Module1").Activate
Application.VBE.ActiveCodePane.Show
End Sub
keepITcool
< email : keepitcool chello nl (with @ and .)
< homepage:
http://members.chello.nl/keepitcool
Mark Tangard wrote:
Hi keepITcool,
Thanks for this. It looked promising, but it didn't change
the behavior. First, for some reason the very last line
throws a 'variable not found' error, and it highlights the
'VBE' -- ehhh? (The VBA extensibility library *is* added
in references.) So I preceded that with 'Application.' and
it stopped complaining, but the problem continued.
When I inserted an 'On Error GoTo 0' after the End If, then,
on this line:
wkb.VBComponents("Module1").Activate
I get an non-supported property/method error. Fixed that
by using:
wkb.VBProject.VBComponents("Module1").Activate
But the behavior continues. I added an Application.OnTime
statement at the end and moved the last line (the .Show)
into its own macro, to run 1 second later. Still no change.
Grrr. What could be wrong??
Thanks again for following up.
--
Mark Tangard , Microsoft Word MVP
"Life is nothing if you're not obsessed." --John Waters
keepitcool wrote:
Mark,
try this:
1.checks to see if opened, if not does.
2.activates codemodule
3.activates VBE