I am not sure if this is out of scope for this fourm but I am a newbee having trouble with a function. I am trying to paste text from the clipboard into a new MS word doc, then save the file as a new file using the first line of text as the file name. I keep getting a error saying that my name is not valid. Here is the code I wrote..any thoughts?
VB.NET:
Dim title As String
Dim newdoc As Word.Document
Word.Documents.Add
Selection.PasteAndFormat (wdFormatPlainText)
'select first line for name
Dim lines As Range
Set lines = ActiveDocument.Range( _
Start:=ActiveDocument.Paragraphs(1).Range.Start, _
End:=ActiveDocument.Paragraphs(1).Range.End)
lines.Select
lines.Copy
title = lines
ActiveDocument.SaveAs FileName:="D:\Documents and Settings\Doug.OFFICE\Desktop\" & title & ".doc"