I have a word template that already is set to execute a function by an application and create a new doc. I'd like to add a sub and pull in one table from one sheet in an existing excel wb. I understand how to set the reference for ws, how can I add a routine here that will pull in the table from the sheet? I've been doing it with an Excel Marco after I run the application template, but would like it all done at the same time.
Here is the existing function:
' Execute
Public Function Execute(POM As Object) As Long
On Error GoTo Execute_Error
Dim CurrDoc As Document
Dim Doc As Document
Set CurrDoc = ActiveDocument
Set Doc = Documents.Open(POM.Path & POM.Product.ID & "\Signatures.dot", , , True, , , , , , , , False)
Doc.Execute POM, CurrDoc, "Signatures", POM.FundingIndex(POM.RecID) + 1
Doc.Close wdDoNotSaveChanges
Set Doc = Documents.Open(POM.Path & POM.Product.ID & "\Signatures.dot", , , True, , , , , , , , False)
Doc.Execute POM, CurrDoc, "Signatures"
Doc.Close wdDoNotSaveChanges
Execute_Exit:
On Error Resume Next
Exit Function
Execute_Error:
Resume Execute_Exit
End Function
Here is the existing function:
' Execute
Public Function Execute(POM As Object) As Long
On Error GoTo Execute_Error
Dim CurrDoc As Document
Dim Doc As Document
Set CurrDoc = ActiveDocument
Set Doc = Documents.Open(POM.Path & POM.Product.ID & "\Signatures.dot", , , True, , , , , , , , False)
Doc.Execute POM, CurrDoc, "Signatures", POM.FundingIndex(POM.RecID) + 1
Doc.Close wdDoNotSaveChanges
Set Doc = Documents.Open(POM.Path & POM.Product.ID & "\Signatures.dot", , , True, , , , , , , , False)
Doc.Execute POM, CurrDoc, "Signatures"
Doc.Close wdDoNotSaveChanges
Execute_Exit:
On Error Resume Next
Exit Function
Execute_Error:
Resume Execute_Exit
End Function