Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to assign a selection to a variable

Status
Not open for further replies.

ikards

Technical User
Jun 16, 2000
9
US
Word VBA newbie. I have "found" a date in a Word doc via "With Selection.Find". I used "Selection.Expand wdSentence" to narrow it down to just the date. Now here's where I feel really stupid. How do I "assign" the selected date to a variable? I want to save it for other uses. I have defined: "Dim sdate As String". I can't find any documentation on the simple assignment of the selection to the variable. "sdate = ??????"
Thanks for your help!

-- Steve Ikard
 
Sorry about that. I did some experimenting and found that the simple "sdate = Selection" does the trick.

-- Steve Ikard

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top