Reopening files problem

  • Thread starter Conrad Santiago
  • Start date
C

Conrad Santiago

I have a macro, see below, that reads a list of projects from a file, opens
one file at a time, then runs a RepublishAssignments command on the open
file. The macro then closes the file and opens the next one. Functionally,
it is working fine except for one thing. After it runs through the entire
list, it cycles through the list again and opens the file and leaves it open.
It doesn't appear to be republishing, it just opens one file and goes on to
the next and opens that one.

I can have over a hundred projects in my list, so my only recourse is to
watch for when it finishes the first cycle, then do a ALT-CTRL-DEL forced
close on MS Project. Then, I have to go back to Web Access and check those
projects that were opened before I did the force closure.
==================================
Sub f360_Co_Publish_List()
Open "T:\test1.txt" For Input As #1

Do While Not EOF(1) ' Loop until end of file.
Line Input #1, TextLine ' Read line into variable.
Pub_File = "<>\" + TextLine + ".Published"
FileOpen Name:=Pub_File
RepublishAssignments False, pjPublishScopeAll, False, True, False, ""
FileClose pjSave

Loop
Close #1
End Sub
================================

Oh, now it appears, the republishing isn't working after all. I just
checked and the assignments were not updated in Web Access.

Any clues on solutions here?

Thanks in advance for any responses.
--Conrad Santiago
 
E

Ed Morrison

Your code worked for me in MSP Pro 2003. Try stepping thru the code and see
why it is re-opening your projects. You may have an event that is kicking
off. You can change to parameter of FileClose to pjDoNotSave since the file
is saved as part of the publishing routine.

Check your ViewDrop folder. You may have a backlog of jobs that is slowing
down the publish operation.
 
C

Conrad Santiago

Thanks for the reply, Ed.

I'm still having a problem with this. It happens when I use the
RepublishAssignments command. It doesn't happen when I use the
PublishNewAndChangedAssignments command.

Oddly, when I run this single command macro:

RepublishAssignments False, pjPublishScopeAll, False, True, False, ""

on an open file, it works. It publishes the updated assignment and it
doesn't reopen the file, so it has something to do with the multiple projects
opening and closing one after another. Any suggestions? It sounds
primitive, but would pausing the macro for a few seconds help?

--Conrad Santiago
 

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