Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save file using paste function 1

Status
Not open for further replies.

Coot402

Programmer
May 14, 2003
3
US
I am trying to create a macro in Word that will take a portion of the document that I copy using selection.copy. Then use

ActiveDocument.SaveAs FileName:= (Whatever I had copied to the clipboard)

Here is the code

Sub Macro1()

Selection.HomeKey Unit:=wdStory
Selection.MoveDown Unit:=wdLine, Count:=7, Extend:=wdExtend
Selection.TypeBackspace
Selection.MoveDown Unit:=wdLine, Count:=15
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
ActiveDocument.SaveAs FileName:= _
"this is what I want to paste", _
FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False
End Sub

Any help would be appreciated
 
Hi,

I'm no Word guru, but...
Code:
    Selection.Copy
    ActiveDocument.SaveAs FileName:= Selection.Value, _
        FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _
        AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
        EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
        :=False, SaveAsAOCELetter:=False
Hope this helps :)



Skip,
Skip@TheOfficeExperts.com
 
I appreciate the help Skip but that gives me the

Compile error
Method or data member not found

:-(
 
Works like a champ Skip. Thank you for the help

[thumbsup]
Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top