Referencing Embedded Word Document

tonky25

New Member
Joined
Jul 22, 2010
Messages
1
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
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Watch MrExcel Video

Forum statistics

Threads
1,133,275
Messages
5,657,786
Members
418,413
Latest member
Radoslaw Poprawski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top