[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Word 2003 : Macro Question

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
itbabe
Asked:
itbabe
1 Solution
 
mvidasCommented:
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
 
gbahriCommented:
You can also ignore "Text:=" in this case:
e.g.
Selection.TypeText ActiveDocument.FullName

thanks,

GBahri
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now