#1
|
|||
|
|||
assign variable name to WORD text
In my opened WORD document I have a bookmarked text (the Title, in this case).
How do I read and assign this Title text as a variable in VBA ? I will be using this variable to access other files with the Title in the filenames. Thanks ! |
#2
|
|||
|
|||
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim strText As String strText = ActiveDocument.Bookmarks("Title").Range.Text End Sub |
#3
|
|||
|
|||
Thanks ! It worked perfect...
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
object variable or with block variable not set | MJP143 | Excel | 1 | 02-11-2013 05:07 AM |
Import from variable length text | diouna | Excel | 3 | 07-10-2012 09:43 PM |
Run-time error '91': Object variable or With block variable not set | tinfanide | Excel Programming | 2 | 06-10-2012 10:17 AM |
Word VBA: assign shortcut keys to sub??? | tinfanide | Word VBA | 2 | 12-05-2011 03:41 AM |
Assign name to a group in word document | pankaj_saha | Word | 0 | 11-12-2009 10:59 PM |