Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

Counter macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Herpenc - 16 Mar 2005 15:55 GMT
The macro has to come in a .doc file and has to start another macro that is
placed in the MS Word startup directory. The macro have to start
automatically when the document is been opened for the first time. When the
document has been closed and startup again the macro may not start. There
have to come a counter on it.

The line below wil start the macro:
    Sub auto_open()

           Application.Run MacroName:="firstdoc_auto_open"
    End Sub

But it does'nt start automatically and is has no counter on it. How can I do
this  please help me. Thanks!!
Helmut Weber - 16 Mar 2005 19:18 GMT
Hi,

how about this one:

Sub autoopen()
On Error Resume Next
If ActiveDocument.Variables("OpenedBefore") = "" Then
ActiveDocument.Variables("OpenedBefore") = 1
MsgBox "first time"
ActiveDocument.Saved = False
ActiveDocument.Save
Exit Sub
Else
  MsgBox "openend before" ' or run another macro
End If

End Sub

End Sub

Note: "autoopen", not "auto_open"

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.