If I have a Word .doc file that has macros in it (see below) that are digitally signed can those digitally signed macros persist and use data from the database during the Aspose merge process? For example, we’re trying to pull a path from the database based upon the currently logged-in username and then merge their scanned signature JPG from disk using INCLUDEPICTURE.
SigMergeTokens.JPG (8.0 KB)
Thanks,
Greg
Sub AutoOpen()
Call GetSignature
End Sub
Sub GetSignature()
'There are two bookmarks needed in the Word doc:
' The FIRST one called "bkFullSigPath" which holds the full signature path to the JPG as returned from the stored proc (e.g. \\\\SERVERNAME\\share\\Signatures\\GBROWN.jpg)
' Then a SECOND one called "bkIncludePicture" which uses the above bookmark to set the value in the INCLUDEPICTURE merge field which is already present in the Word doc.
Dim strFullPathToSig As String 'This will hold the full path to the JPG signature file as returned from the stored proc and located using the 1st bookmark
'Store the full sig path in the above variable:
strFullPathToSig = ActiveDocument.Bookmarks("bkFullSigPath").Range.Text 'the FIRST bookmark
Dim fld As Field 'this is going to be the reference to the {INCLUDEPICTURE} merge field that is already present in the Word doc (this field is found using the 2nd bookmark)
'Set this reference using the 2nd bookmark
Set fld = ActiveDocument.Bookmarks("bkIncludePicture").Range.Fields(1)
'Inject the INCLUDEPICTURE merge field with dynamic path into the fld
fld.Code.Text = "INCLUDEPICTURE " & Chr(34) & strFullPathToSig & Chr(34) & " \d "
fld.Update
'Clear out the returned path from the initial bookmark so that the user doesn't have to see it
ActiveDocument.Bookmarks("bkFullSigPath").Range.Text = ""
End Sub