M
Mark Loveless
Because I have tons of government and commerical blank forms already
in proportional fonts, here is what I would *like* to do:
Context: I am plugging Access form & table data elements at specific
bookmarks in these forms. Several bookmarks occur on the same line,
so substituting text for spaces will screw up the alignment despite my
best efforts (see Sidenote 1 below). I would like to save the absolute
position of these bookmarks before writing text then correct the
insertion point when actually used.
So,
Create a table from the Range.Information property of Bookmark with
Bookmark
Veritical position relative to top of page
Horizontal position relative to top of page
for all bookmarks in documents
Then, before inserting the replacement text for each bookmark
Bookmark.range (move to original location)
Ideally, "move to original location" would be a single operation, but
it appears Range can only be set with characters, not with absolute
position, so the actual move would probably be more like
Do until Current.Vertical = Table.Vertical(Bookmark)
if current.vertical < table.vertical then
range.movedown
else
range.moveup
End do
and likewise for horizontal (understanding that exact position
probably cannot be matched, actual Do statement compare would be
difference < .01 inch or some such)
Doable?
Sidenote 1: All this could be avoided if there was a way to determine
For textstring x in the current font/pointsize,
how many spaces of same font/pointsize need to be eaten?
e.g. The length of string "John Doe" in Times New Roman 9 point
is equal to the length of 11 spaces in Times New Roman 9 point
so alignment preserving substitution is
range(Bookmark.start, bookmark.start + 11)
range.delete
range.text = "John Doe"
I haven't been able to determine the size in points or characters of a
string without having to already have inserted the string in the word
document.
Any help greatly appreciated. I've gotten by so far because the forms
are simple and between using tables for alignment and using the
substitution formula
Number of spaces to delete = Len(substitution text) * 2 - 1
but I am now having to plug very compact, busy forms (such as the
Uniform Residental Loan Application, Form 1003, from Fannie mae) and
that is not close enough.
Help! TIA
Mark Loveless
Reluctant VBA Progammer
in proportional fonts, here is what I would *like* to do:
Context: I am plugging Access form & table data elements at specific
bookmarks in these forms. Several bookmarks occur on the same line,
so substituting text for spaces will screw up the alignment despite my
best efforts (see Sidenote 1 below). I would like to save the absolute
position of these bookmarks before writing text then correct the
insertion point when actually used.
So,
Create a table from the Range.Information property of Bookmark with
Bookmark
Veritical position relative to top of page
Horizontal position relative to top of page
for all bookmarks in documents
Then, before inserting the replacement text for each bookmark
Bookmark.range (move to original location)
Ideally, "move to original location" would be a single operation, but
it appears Range can only be set with characters, not with absolute
position, so the actual move would probably be more like
Do until Current.Vertical = Table.Vertical(Bookmark)
if current.vertical < table.vertical then
range.movedown
else
range.moveup
End do
and likewise for horizontal (understanding that exact position
probably cannot be matched, actual Do statement compare would be
difference < .01 inch or some such)
Doable?
Sidenote 1: All this could be avoided if there was a way to determine
For textstring x in the current font/pointsize,
how many spaces of same font/pointsize need to be eaten?
e.g. The length of string "John Doe" in Times New Roman 9 point
is equal to the length of 11 spaces in Times New Roman 9 point
so alignment preserving substitution is
range(Bookmark.start, bookmark.start + 11)
range.delete
range.text = "John Doe"
I haven't been able to determine the size in points or characters of a
string without having to already have inserted the string in the word
document.
Any help greatly appreciated. I've gotten by so far because the forms
are simple and between using tables for alignment and using the
substitution formula
Number of spaces to delete = Len(substitution text) * 2 - 1
but I am now having to plug very compact, busy forms (such as the
Uniform Residental Loan Application, Form 1003, from Fannie mae) and
that is not close enough.
Help! TIA
Mark Loveless
Reluctant VBA Progammer