Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2013, 11:29 AM
norwood norwood is offline assign variable name to WORD text Windows Vista assign variable name to WORD text Office 2000
Novice
assign variable name to WORD text
 
Join Date: Sep 2013
Posts: 23
norwood is on a distinguished road
Default 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 !
Reply With Quote
  #2  
Old 09-11-2013, 12:55 PM
gmaxey gmaxey is online now assign variable name to WORD text Windows 7 32bit assign variable name to WORD text Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim strText As String
strText = ActiveDocument.Bookmarks("Title").Range.Text
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 09-13-2013, 08:00 AM
norwood norwood is offline assign variable name to WORD text Windows Vista assign variable name to WORD text Office 2000
Novice
assign variable name to WORD text
 
Join Date: Sep 2013
Posts: 23
norwood is on a distinguished road
Default

Thanks ! It worked perfect...
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
assign variable name to WORD text object variable or with block variable not set MJP143 Excel 1 02-11-2013 05:07 AM
assign variable name to WORD text Import from variable length text diouna Excel 3 07-10-2012 09:43 PM
assign variable name to WORD text Run-time error '91': Object variable or With block variable not set tinfanide Excel Programming 2 06-10-2012 10:17 AM
assign variable name to WORD text 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft