Method 'Run' of object '_Global' failed when changing OS and Office versions

  • Thread starter Thread starter Ronj
  • Start date Start date
R

Ronj

I am getting a Run-time error '1004': Method 'Run' of
object '_Global' failed when running the same code that
works perfectly on NT 4.0, Excel 97. Forced to move to
Win 2000 with Excel 2000. Not an Excel or VB expert, so
the Microsoft Knowledgebase hit didn't help me.

I have a subrouting called DoIt:

Sub DoIt()
Sheet1.Initializer
Sheet1.loadup
Sheet1.copyover
Sheet1.titles
Sheet1.BuildIOPacektsChart
Sheet1.BuildIOPacketErrsChart
Sheet1.Conv2html
Sheet1.ToGifs
Sheet1.SaveHtml

End Sub

It is called from the Auto_Open function to run when the
file is executed:

Public Sub Auto_Open()
' Will automatically run when this app is started.

Run ("Sheet1.DoIt")

Application.DisplayAlerts = False
' Quit - close down Excel.
Application.Quit

End Sub

The failure happens on the line: Run ("Sheet1.DoIt")

I have absolutely no idea where to even start. Any help
would be greatly appreciated.

Thanks.
Ronj
 
Ronj,

Not sure about your syntax.
Looks like your code is in sheet modules. If so you will have problems.
It will only work if the code you are calling is in a standard module.

Instead of Run, I like to use the form
Module1.Macro1 'change the names to match your code.

steve
 
[This followup was posted to microsoft.public.excel.programming with an
email copy to Ronj.
Please use the newsgroup for further discussion.]

Once you replace the Run with just Sheet1.DoIt (as suggested by Steve),
what happens if you step through the code (with F8)? It should
pinpoint the line tha generates the error.

Of course, I don't quite understand why all the code is buried in the
Sheet1 module since it doesn't seem to be related to the sheet1 object.
But, that is another story.

--
Trouble finding replies to your posts? Use a newsreader. See the
tutorial 'Outlook Express and Newsgroups' on my web site

Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Back
Top