P
Poseur
This is not a question but an answer to one that has not been
asked. Recently.
I wanted to save a new document as "firstline text".doc
Public Sub SaveTest()
Dim fn As String
Selection.HomeKey Unit:=wdStory
Selection.Expand (wdLine)
fn = Selection.Text
fn = "d:\documents and settings\...\" & fn
ActiveDocument.SaveAs FileName:=fn, _
FileFormat:wdFormatDocument
End Sub
Kept getting file permission error.
The problem apparently is that the selected text included the
carriage return at the end.
This works:
....
fn = Selection.Text
fn = "d:\documents and settings\dan\my documents\" & Left(fn,
Len(fn) - 1)
ActiveDocument.SaveAs FileName:=fn, FileFormat:
=wdFormatDocument
So, next time someone does a google search on this, maybe this
will be helpful.
asked. Recently.
I wanted to save a new document as "firstline text".doc
Public Sub SaveTest()
Dim fn As String
Selection.HomeKey Unit:=wdStory
Selection.Expand (wdLine)
fn = Selection.Text
fn = "d:\documents and settings\...\" & fn
ActiveDocument.SaveAs FileName:=fn, _
FileFormat:wdFormatDocument
End Sub
Kept getting file permission error.
The problem apparently is that the selected text included the
carriage return at the end.
This works:
....
fn = Selection.Text
fn = "d:\documents and settings\dan\my documents\" & Left(fn,
Len(fn) - 1)
ActiveDocument.SaveAs FileName:=fn, FileFormat:
=wdFormatDocument
So, next time someone does a google search on this, maybe this
will be helpful.