PDA

View Full Version : Solved: save as filename



suji
11-28-2008, 09:33 AM
Hi,

Can someone tell me how I can save a file with filename as the first five letters of the second line.

Thanks
Suji

TonyJollans
11-28-2008, 09:42 AM
Something like this?
Selection.HomeKey wdStory
Selection.MoveDown
Selection.MoveEnd wdCharacter, 5
ActiveDocument.SaveAs Selection.Text

suji
11-28-2008, 10:35 AM
fabulous. Thanks

fumei
11-28-2008, 10:41 AM
Or (as we all know I try to avoid Selection...), if the second "line" is a paragraph, you can do it with one instruction...

ActiveDocument.SaveAs Left(ActiveDocument.Paragraphs(2), 5)

suji
11-28-2008, 09:47 PM
that was even better.