Hi,
My code as it is copies all Rows in the range to the opened Word Doc but I only want to copy nonblank ones.
Then I want to use SaveAs FileDialog to open at the folder location that the opened Word Doc is in. This is so I can see the other files in that folder and know what to rename this new Word Doc as, I will then manually rename it.
Help would be greatly received
julhs
Sub cmd_Copy_to_Template() 'Opens a specific Word Doc from
'a CommandButton on Excel sheet then copies and
'pastes a given range from the Excel sheet to a
'given location in the Template Word Document
'step1: Declare your variables
Dim MyRange As Excel.Range
Dim wd As Word.Application
Dim wdDoc As Word.Document
Dim WdRange As Word.Range
'step2:Copy the defined range
ThisWorkbook.ActiveSheet.Range("A17:C59").Copy
'Step 3: Open the target Word Document
Set wd = New Word.Application
Set wdDoc = wd.Documents.Open("C:\Users\Julian\Documents\My Documents\Jobsheet\Work carried out #New Template 2013(1).docx")
wd.Visible = True
'Step4: Set focus on the target bookmark
Set WdRange = wdDoc.Bookmarks("JobSheet_Template_insert_point").Range
'Step5: Delete the old and paste the new
On Error Resume Next
WdRange.Tables(1).Delete
WdRange.PasteAndFormat (wdPasteDefault)
'Step6: Reinsert the bookmark
wdDoc.Bookmarks.Add "JobSheet_Template_insert_point", WdRange
'Step7: Memory clean up
Set wd = Nothing
Set wdDoc = Nothing
Set WdRange = Nothing
Set MyRange = Nothing
End Sub
Bookmarks