View Single Post
 
Old 04-28-2017, 08:04 AM
ilcaa72 ilcaa72 is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jan 2014
Posts: 27
ilcaa72 is on a distinguished road
Default

i did a little more investigating and found something called Document Variables. Variables that are 'stored' in the document once the Sub ends. I have been able to assign some Sentence property values to the variables like this...

Just want to check to see if anyone thinks this is a good/right approach?
Also, i encountered 2 issues...
1. When i run it again it errors, "Variable Name Exists" - so how do i destroy the variable name for reuse?
2. in a standalone Sub or in Immed Window, "ActiveDocument.Range(0, Selection.Range.End).Sentences.Count" returns the currently selected Sentence number. But when assigning it to this variable, its displays 0

any thought or assistance? thanks

Code:
 With x
        ActiveDocument.Variables.Add Name:="selSize", Value:=.Font.Size
        ActiveDocument.Variables.Add Name:="selColor", Value:=.Font.Color
        ActiveDocument.Variables.Add Name:="selName", Value:=.Font.Name
        ActiveDocument.Variables.Add Name:="selNumb", Value:=Sent_number = _ ActiveDocument.Range(0, Selection.Range.End).Sentences.Count
Reply With Quote