Hi,
I have been trying to take data from excel and insert into a word document using VBA and have used the code in this thread VBA Export excel data
I have removed the save element as want to insert the data and then be able to edit elements of the rest of the document and then save as a different file name.
Two issues I have is, it inserts as an image and Inserts at the very top of the word document.
So, is it possible to insert as Paste Special> Values & Source formatting rather than as a picture and/or insert at a point in the document why you can specify. In the top line I have a line of text and wish to have the Excel data pasted below the this line of text. I tried to have it select the end of the line and do a return but just kept getting errors.
If I can do either then it will solve the issue as I can either add the line of text to the top of the excel data (but still be able to edit it) or insert the excel data after the line of text? I have added an image so you can see what I mean.
Any help will be gratefully received, VBA is not my strong point I'm affraid.
I have been trying to take data from excel and insert into a word document using VBA and have used the code in this thread VBA Export excel data
I have removed the save element as want to insert the data and then be able to edit elements of the rest of the document and then save as a different file name.
Two issues I have is, it inserts as an image and Inserts at the very top of the word document.
So, is it possible to insert as Paste Special> Values & Source formatting rather than as a picture and/or insert at a point in the document why you can specify. In the top line I have a line of text and wish to have the Excel data pasted below the this line of text. I tried to have it select the end of the line and do a return but just kept getting errors.
If I can do either then it will solve the issue as I can either add the line of text to the top of the excel data (but still be able to edit it) or insert the excel data after the line of text? I have added an image so you can see what I mean.
VBA Code:
Sub DailyReportData()
Dim WdObj As Object, fname As String
fname = "Daily Report Output"
Set WdObj = CreateObject("Word.Application")
WdObj.Visible = False
Range("A1:E33").Select
Selection.Copy 'Your Copy Range
WdObj.Documents.Open Filename:="C:\Users\PATHtoFile\Daily Report DATE.docx"
WdObj.Selection.PasteSpecial Link:=False, _
DataType:=wdPasteText, Placement:= _
wdInLine, DisplayAsIcon:=False
Application.CutCopyMode = False
End Sub
Any help will be gratefully received, VBA is not my strong point I'm affraid.