Referencing Embedded Word Document


New Member
Jul 22, 2010
Hi guys!

The situation is I have a working macro that converts an outdated document to an updated one. Im doing this by inputting the old document and the template for the new document and also by stating the output destination (the macro will generate the new document).

What I'm planning to do is to embed the template file to another worksheet (same document just another sheet) so that I wouldn't have to input the template file and let the macro automatically use the template which I embedded on another sheet.

My question is how do I make a reference to the embedded file so that I could use it in the program.

Thanks in advance guys! I really hope that someone could help me. :D

My current code goes like this (only includes up to getting the inputted template file):

This is the main code...

Sub DDConvert_Click()

Dim wrdApp As Object
Dim wrdDoc As Object
Dim wrdTemp As Object
Dim ErrCnt As Integer
'Dim Errnum As Variant

ErrCnt = 0
'Errnum = Array()
Call ValidateDDTool(ErrCnt)
If ErrCnt > 0 Then
GoTo ErrExit:
End If

ToolFile = ThisWorkbook.Name
InptFile = Cells(4, 4)
OutptFile = Cells(5, 4) & "\"
TemplateFile = Cells(6, 4)

Set wrdApp = CreateObject("Word.Application")
'wrdApp.Visible = True

'open input and template file
Set wrdDoc = wrdApp.Documents.Open(InptFile)
Set wrdTemp = wrdApp.Documents.Open(TemplateFile)


This is how i get the template...

Sub TempFile_Click()

OldTmpFile = Cells(6, 4)
Cells(6, 4) = Application.GetOpenFilename("Excel Files (*.doc), *.doc")
NewTmpFile = Cells(6, 4)

End Sub

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...