![]() |
#1
|
|||
|
|||
![]() My VB application uses a set of Word templates to create a series of PDFs, into some of which get inserted digital signature fields. My current challenge involves locating that digital signature field accurately since the content of the Word documents is not static. Some paragraphs (bullets) get deleted based on user specified criteria, which causes the salutation to move vertically. What I've come up with so far is to place a small square shape just above the salutation in my templates, make all my bullet adjustments, calculate the coordinates of the Shape (which moves), and then delete it prior to generating the PDF. However, this Shape is somewhat of a nuisance to manage. Instead, is there any way to calculate the dynamic coordinates/vertical location of a DocVariable field, bookmark or paragraph so I don't have to deal with this Shape in all my templates? Thanks. |
#2
|
|||
|
|||
![]()
Solved. Found the solution.
Code:
dim SigPosY as long SigPosY = wdocTemplate.Bookmarks("DigSigPos1").Range.Information(wdVerticalPositionRelativeToPage) Cheers. |
#3
|
||||
|
||||
![]()
I'm curious as to why you need the vertical offset (you can get a horizontal one as well), when you can address the bookmark range directly without even knowing what page it's on.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
![]()
Since the content of my Word document changes, which results in a dynamic verticality, I was having a difficult time calculating where to insert the signature field without a marker that would move with my content. Shapes act strangely and inconsistently, at least in my experience. All the bookmark does, in this case, is serve as that moving marker, and it seems to be far more stable than my previous method of using a shape.
Previously, all the advice I received was that the vertical position of a bookmark was not attainable. I was really glad to finally learn differently. And it came from a fairly old post I just stumbled upon. The horizontal position is not a problem since it's based on my left margin, but I do realize I can get the offset the same way if needed. If there is a better suggestion as to how I might do this more effeciently I'd love to read it. Thanks. |
#5
|
||||
|
||||
![]()
Since you have the bookmark, you can simply insert the sig as an inlineshape at that point. If you need, you can then use the converttoshape method to apply text-wrapping. No need to calculate coordinates.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
![]()
maxInCO, macropod is talking about something like this:
Code:
Sub UpdateBM2(strBM As String, strImageName As String) Dim r As Range Set r = ActiveDocument.Bookmarks(strBM).Range r.InlineShapes.AddPicture FileName:=strImageName, LinkTofile:=False ActiveDocument.Bookmarks.Add Name:=strBM, Range:=r End Sub Sub InsertTheSignature() Call UpdateBM2("SignatureHere", "c:\TestDocs\Signature1.jpg") End Sub The second procedure (InsertTheSignature) calls the insertion procedure with the variable of the image file. Needless to say it would also be possible to have a process to get the file name by user input, or a list of signature that you can select. You can of course change the parameters like LinkToFile, SaveWithDocument of AddPicture. And, as macropod mentions you can use the converttoshape method to apply text-wrapping |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
icloudy | Word | 1 | 12-09-2012 03:49 PM |
![]() |
gsrikanth | Excel | 1 | 07-07-2012 08:16 AM |
calculate age | userman | Excel | 8 | 06-02-2012 10:59 PM |
![]() |
cyndor | Word | 2 | 04-06-2012 03:57 AM |
![]() |
LeeFX | Word | 4 | 05-05-2011 05:53 PM |