Hi,
I have emails going to Outlook and I want to create a macro to copy part of the text and paste into a table in a word document, then 'save as' using one part of the text as the filename. I'd be grateful if someone could help me.
This is what I have:
"Sub Page()
Selection.Copy
Windows("Page").Activate
ActiveDocument.Tables(1).Cell(Row:=1:6, Column:=2).Range.Select
Selection.Paste
Selection.Style = ActiveDocument.Styles("Normal")
ActiveDocument.Tables(1).Cell(Row:=2, Column:=2).Range.Select
ActiveDocument.SaveAs FileName:="'Selection.Paste'.docx", FileFormat:= _ wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles _:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _SaveAsAOCELetter:=False
End Sub"
Problem 1: If the VB code could auto select the text from the email that would be great but just to start off I'd be happy to select this first myself.
Problem 2:
It doesn't seem to go to the document and paste - I get an error. The code to select the table in the doc and then paste is wrong...
Problem 3: It does not save, and if it did it would not be from the selection that it should be using. (btw, The text in row 2, column 2 is just a four-digit number...)
Could anyone correct this for me..?
Thanks!
Bookmarks