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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2003 Macro Question

Status
Not open for further replies.

ComDawg

Vendor
Dec 14, 2001
18
0
0
US
I am trying to create a macro that will allow me to do the following:

From a blank document type "New Fax" press the enter key and have my Fax Cover Template open up. I have the macro recorded and it works fine if I use the keyboard shortcut. Here is the code I have so far:

Sub New_Fax()
'
' New_Fax Macro
' Macro recorded 7/22/2008 by New User
'
Documents.Open FileName:="""My Fax.doc""", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto, XMLTransform:=""
End Sub

Thanks for any help anyone can give me.

John
 
Well, for starters, your fax cover template should be a template file, not a document file.
 





and...

"From a blank document type "New Fax" press the enter key ..."

Type "New Fax" WHERE? In "a blank document"?

You might consider a toolbar button to run this from your Normal.dot.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Why not juat uae the keyboard shortcut, since it works? Entering text then Enter is an inefficient way to execute a macro.

Your code, as it stands, does no testing to see if there is text "New Fax". Using a shortcut, or a button as Skip suggests would be the best way...at least as far as you have described the situation.

Are you using a .doc file as a template? Template is a very specific term in Word. They are NOT .doc files.

faq219-2884

Gerry
My paintings and sculpture
 
Thanks For your input. I will just continue using my hot key or maybe make a toolbar. The main reason I was looking to do this was more so that I may type a persons name in a blank document and have it automatically come up with there info in a fax cover. I listed it as new fax hoping to get a few idea's on some code and take it from there.

Thanks
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top