Solved

Word 2003 : Macro Question

Posted on 2007-04-11
2
172 Views
Last Modified: 2010-04-30
I would like to insert the path of an active document using this macro but the macro gives a compile error.
What could be causing the error ?
Sub Path()
Dim strThisDocument As String
strThisDocument = ActiveDocument.FullName
Selection.Font.Name = "Verdana"
Selection.TypeText Text: strThisDocument
End Sub
0
Comment
Question by:itbabe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
ID: 18890191
Hi itbabe,

You're missing the = after the : in the TypeText line:

Selection.TypeText Text:=strThisDocument

Similarly, you could just use:
Selection.TypeText Text:=ActiveDocument.FullName

Matt
0
 
LVL 7

Expert Comment

by:gbahri
ID: 18890341
You can also ignore "Text:=" in this case:
e.g.
Selection.TypeText ActiveDocument.FullName

thanks,

GBahri
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question