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
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