M
maperalia
I have a program (see bellow) that I can’t make it work.
Basically, the program copy excel cells, open specific word file, however,
it not paste it the cells into the word document.
Could you please help me with this matter?
Thanks in advance.
Maperalia.
Option Explicit
Public Sub CopyExcelToWord()
CopyCellsFromExcel
OpenAWordFile
PasteIntoWord
End Sub
Sub CopyCellsFromExcel()
'***********COPY CELLS IN EXCEL****************************
Range("A1:I66").Select
Selection.Copy
Application.CutCopyMode = False
Range("A1:I1").Select
'**********************************************************
End Sub
Sub OpenAWordFile()
Dim wordApp As Object
Dim fNameAndPath As String
'***********OPEN THE MICROSOFT WORD FILE****************************
fNameAndPath = "H:\Projects\Geolabs Special Projects\Proposals\Proposed
Cost Geotechnical Service Template.dot"
Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open (fNameAndPath)
wordApp.Visible = True
'**********************************************************
End Sub
Sub PasteIntoWord()
Dim wdPasteOLEObject As String
Dim wdInLine As String
'***********PASTE THE EXCEL CELLS INTO WORD
FILE****************************
Selection.PasteSpecial Link:=True, DataType:=wdPasteOLEObject,
Placement:=wdInLine, DisplayAsIcon:=False
'**********************************************************
End Sub
Basically, the program copy excel cells, open specific word file, however,
it not paste it the cells into the word document.
Could you please help me with this matter?
Thanks in advance.
Maperalia.
Option Explicit
Public Sub CopyExcelToWord()
CopyCellsFromExcel
OpenAWordFile
PasteIntoWord
End Sub
Sub CopyCellsFromExcel()
'***********COPY CELLS IN EXCEL****************************
Range("A1:I66").Select
Selection.Copy
Application.CutCopyMode = False
Range("A1:I1").Select
'**********************************************************
End Sub
Sub OpenAWordFile()
Dim wordApp As Object
Dim fNameAndPath As String
'***********OPEN THE MICROSOFT WORD FILE****************************
fNameAndPath = "H:\Projects\Geolabs Special Projects\Proposals\Proposed
Cost Geotechnical Service Template.dot"
Set wordApp = CreateObject("Word.Application")
wordApp.Documents.Open (fNameAndPath)
wordApp.Visible = True
'**********************************************************
End Sub
Sub PasteIntoWord()
Dim wdPasteOLEObject As String
Dim wdInLine As String
'***********PASTE THE EXCEL CELLS INTO WORD
FILE****************************
Selection.PasteSpecial Link:=True, DataType:=wdPasteOLEObject,
Placement:=wdInLine, DisplayAsIcon:=False
'**********************************************************
End Sub