Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Word 2003 : Macro Question

Posted on 2007-04-11
2
Medium Priority
?
174 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

722 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