ActiveDocument - AutoOpen

D

dickohead

Good morning,

I am trying to create a macro that will allow me to recall the AutoOpen
function of the current document.

I have been trying the following with no prevail:

From within my Normal.dot file, this one only causes errors.
Code:
Sub Reset_Document()
Application.Run ActiveDocument.ThisModule.ThisProcedure
End Sub

and this one does half the job

Code:
Sub Reset_Document()
With ActiveDocument
.Reload
.ResetFormFields
End Sub

and this one only errors

Code:
Sub Reset_Document()
With ActiveDocument
.ResetFormFields
AutoOpen()
End Sub

Now the middle one causes my fields to be cleared, which is nice; but I have
some Input boxes that appear when the user opens the document and they do not
appear.

So my question is: How do I recall the AutoOpen function of my document from
a Macro stored in another document?

On another note, how do I highlight code?
 
D

Doug Robbins - Word MVP

If your document is being created from a template, the template probably has
an Autonew macro in it and it is probably that macro that you may want to be
re-running.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

dickohead

the documents are standalone files, with a .doc extension. They could be
template files, but it doesn't change much sich the files are being access
from within a Sharpoint Site, so access is restricted anyway.

How would I programatically reference another document, given that the name
of the document will change?

Something like: ActiveDocument.AutoOpen() sort of made sense to me, but it
doesn't do anything.

Doug Robbins - Word MVP said:
If your document is being created from a template, the template probably has
an Autonew macro in it and it is probably that macro that you may want to be
re-running.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

dickohead said:
Good morning,

I am trying to create a macro that will allow me to recall the AutoOpen
function of the current document.

I have been trying the following with no prevail:

From within my Normal.dot file, this one only causes errors.
Code:
Sub Reset_Document()
Application.Run ActiveDocument.ThisModule.ThisProcedure
End Sub

and this one does half the job

Code:
Sub Reset_Document()
With ActiveDocument
.Reload
.ResetFormFields
End Sub

and this one only errors

Code:
Sub Reset_Document()
With ActiveDocument
.ResetFormFields
AutoOpen()
End Sub

Now the middle one causes my fields to be cleared, which is nice; but I
have
some Input boxes that appear when the user opens the document and they do
not
appear.

So my question is: How do I recall the AutoOpen function of my document
from
a Macro stored in another document?

On another note, how do I highlight code?
 
D

dickohead

It's alright, this is how I did it:

Sub Reset_Documents()
ActiveDocument.RunAutoMacro wdAutoOpen
End Sub

Thanks Doug, you got me thinking about what I was actually trying to
reference.

:eek:)
 

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