Lakesactor
New Member
- Joined
- Mar 22, 2017
- Messages
- 3
I'm trying to piece together a VBA code to export a selection from an Excel tab and add it, as a picture, to the end of a user selected word document.
So far i've gotten
this code, however, generates errors no mater what tweaks I make. Unfortunately my coding skill is limited to what I can google, and get to talk to each other. this one's been failing me.
So far i've gotten
Code:
Sub archivetowrd()
'
Dim objWord, objDoc As Object
Dim strFileToOpen As String
strFileToOpen = Application.GetOpenFilename _
(Title:="Please choose a file to open", _
FileFilter:="Word Files *.docx*,")
If strFileToOpen = False Then
MsgBox "No file selected.", vbExclamation, "Sorry!"
Exit Sub
Else
Workbooks.Open Filename:=strFileToOpen
End If
ActiveWindow.View = xlNormalView
Range("A1:G18").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set objWord = CreateObject("Word.<wbr>Application")
Set objDoc = strFileToOpen
objWord.Visible = True
objWord.Selection.Paste
objWord.Selection.<wbr>TypeParagraph
ActiveWindow.View = xlNormalView
Range("A1:G18").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set objWord = CreateObject("Word.<wbr>Application")
Set objDoc = StrFileToOppen
objWord.Visible = True
objWord.Selection.Paste
objWord.Selection.<wbr>TypeParagraph
End Sub
this code, however, generates errors no mater what tweaks I make. Unfortunately my coding skill is limited to what I can google, and get to talk to each other. this one's been failing me.