PDA

View Full Version : Solved: Word Constants



mdmackillop
05-05-2010, 05:43 AM
A simple little task, but I'm not getting it!
Move to the start of an opened Word document

Set MyRange = Wd.ActiveDocument
With MyRange
.MoveStart Unit:=wdStory, Count:=-1
End With

SamT
05-05-2010, 06:46 AM
That snippet is trying to move the active document to the start of a, (unspecified,) document.

Perhaps ypu want

'This example applies bold formatting to the first 10
'characters in the active document.
Sub DocumentRange() ActiveDocument.Range(Start:=0, End:=10).Bold = TrueEnd Sub

Dave
05-05-2010, 07:04 AM
HTH. Dave

http://peltiertech.com/Excel/EarlyLateBinding.html
"The easiest way to determine the values of these constants is, before removing the reference to the other application's object model, finding it in the Object Browser, or in the Immediate Window, typing a question mark followed by the constant name, then pressing Enter"

mdmackillop
05-05-2010, 07:30 AM
Thanks both
This does what I need

Wd.Selection.HomeKey Unit:=6

Tinbendr
05-06-2010, 02:45 PM
Also

Wd.Selection.Collapse 0

mdmackillop
05-06-2010, 02:47 PM
Thanks
I'll try that tomorrow.