Endless Loop

S

Swark

New to VBA/Macros and have gotten myself into a pickle with the following:

Private Sub Project_Open(ByVal pj As Project)
FileOpen Schedule.xls
FilePreview
End Sub

The language may not be correct because I'm recalling it by memory. The
problem is that Project loads the file, previews it and upon exit, continous
to load the file and preview - in an endless loop. I exit only by Windows
Task Manager->End Task.

Tried to rename Global.mpt with no change. I can't use Project until I
(you?) solve this - need help!

Seth
 
J

John

Swark said:
New to VBA/Macros and have gotten myself into a pickle with the following:

Private Sub Project_Open(ByVal pj As Project)
FileOpen Schedule.xls
FilePreview
End Sub

The language may not be correct because I'm recalling it by memory. The
problem is that Project loads the file, previews it and upon exit, continous
to load the file and preview - in an endless loop. I exit only by Windows
Task Manager->End Task.

Tried to rename Global.mpt with no change. I can't use Project until I
(you?) solve this - need help!

Seth

Seth,
Well, it's in an endless loop because when the file is opened it "fires"
the Open Event. The first thing the event macro does is to call the open
event again (i.e. FileOpen). Bad news.

Normally an Open Event macro will only impact the file it is embedded in
but it looks like you put it in your Global, so any file that opens,
including the Project1 default file, enters the twilight zone and never
domes out.

I think your best bet at this point is to put your existing Global in
the trash. Unfortunately you will lose all custom views, tables,
filters, etc. but if you were prudent, you will have periodically saved
your Global into a backup file for an occasion such as this. If you
didn't, too bad.

Once your active Global is in the trash, open Project. Project will
automatically generate a new clean generic Global - the same one that
opened with Project the very first time you used the application.

John
Project MVP
 
J

Jack Dahlgren

I think you can just hold down the Shift key when you start to disable
macros...

Give it a try.

-Jack Dahlgren
 
J

John

Jack Dahlgren said:
I think you can just hold down the Shift key when you start to disable
macros...

Give it a try.

-Jack Dahlgren

Jack,
Thanks. Believe it or not, that little trick came to me in the middle of
the night but I didn't remember exactly which key it was and I wasn't
about to get out of bed and go "fix" my answer.

John
 
S

Swark

Thanks all - I found the control-break key and am able to stop the macro.
BTW I originally file searched entire drive for global.mpt - renamed all to
*.BAK and still had the endless loop problem.

How do I force project to open 'schedule.xls' automatically? Keep in mind
that schedule.xls is regenerated from another source each time, that is the
file is never 'saved' be project - so I can't store the macro there. Thanks
in Advance
 

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