Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wierd request: need to close Word and ReOpen once. 1

Status
Not open for further replies.

LikeThisName

Vendor
May 16, 2002
288
US
I need to close winword on open and then reopen it.

why. each day macros are pushed out first time word is opened but the macro's don't run until word is exited and reopened.

any ideas?

TIA

LikeThisName <- ? Sorry It's Taken =)
 
Try something along these lines.

Create a .ini file and seed it with a "false" flag.

write AutoExec to do the following:
Check the .ini file

If started today = true then

change flag to fasle.
end AutoExec

If started today = false then

change flag to true.
use shell to start a .bat file that waits for a while, then calls winword.exe.
.close word



 
I am dying of curiousity. Macros "pushed out"????? By what? Word? Are you saying Word is "pushing out" macros? Pushing put to what?? To where??

Could you explain what the code is, that requires Word to be restarted so it can run? Could you run another instance of Word?

It may seem dumb of me to ask, but...huh?

The solution from mintjulep seems reasonable. Word can not start itself. A batch file can Shell to it though.

Gerry
 
minjulep TY! you rock!

what is your advice for calling the flag procedure upon running word?
Code:
Sub aIniReadTest()
    If ReadIniFileString("Anthony", "1stOpen") Then
       WriteIniFileString "Anthony", "1stOpen", False
       MsgBox "TEST WAS TRUE, NOW IS " & ReadIniFileString("Anthony", "1stOpen")
       Shell ("c:\Documents and Settings\openword.bat")
       Application.Quit
    Else
        MsgBox "TEST FALSE " & ReadIniFileString("Anthony", "1stOpen")
    End If
End Sub

fumei,
the network team here pushes out certain files and scripts everyday, rewriting them, it prevents users from screwing something up. maybe its the wrong way to go about it, but i am in no position to say anything. i'm open to suggestions, though for learning sake. so under my conditions it was vital to not have unintended duplicate instances of word open. the code above works great for me. Now just trying out to figure out how to execute automatically.

LikeThisName <- ? Sorry It's Taken =)
 
LikeThisName

If you name a procedure "AutoExec", it will run when Word starts.

Either name your procedure "AutoExec", or create an AutoExec that calls your procedure.

 
great to know, thanks, your original post was thorough, thanks for clarifying and sharing your knowledge. i learned so much.

LikeThisName <- ? Sorry It's Taken =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top