Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert date into "Reserved space"

Status
Not open for further replies.

RCorrigan

MIS
Feb 24, 2004
2,872
MT
I am using bookmarks to insert data from a form into a word doc ..... is there an easy way to 1) limit the availble input on the form (I'm guessing maxlength on field properties and 2) reserve that amount of space for the bookmark (the utimate ain being to preserve the document layout ??

MTIA

<Do I need A Signature or will an X do?>
 
Regarding inserting text into the bookmark...yes, but you would need to determine the logic.

I have to question the business case for this. Does layout trump content? However, if it does, then put the content of the field into a string, rather than putting into the bookmark directly. So:
Code:
Dim strWhatever As String
strWhatever = Me.Textbox1.Text
ActiveDocument.Bookmarks("Whatever").Range.Text = _
   strWhatever
instead of:
Code:
ActiveDocument.Bookmarks("Whatever").Range.Text = _
   Me.Textbox1.Text
If you have it as a string you can do easier manipulation of it.
Code:
Dim strWhatever As String
strWhatever = Me.Textbox1.Text
If Len(strWhatever) > 30 Then
[COLOR=red]' but what????
' say it is 50 characters, WHAT do you
' do with it?  Chop off the first 20 -
' assuming you want to max it at 30?
' the last 20...what?[/color red]

Gerry
My paintings and sculpture
 
Does layout trump content?

Not really ....... but, for instance I know that the comit id will never be anything other than 7 characters (first name, last name of course will be variable, but unlikely to be more than 30 (?) characters - please correct me if you know of anybody with a 57 character first name)

I would like to preserve the layout - which is why I thought of limiting the available text input ---

i.e. (following my logic and using an easy example)
If the comit id is 7 characters then the second field on the same line can be positioned at x, where x = 7 characters (reserved) spaces to x (on form) then 2nd field starts here) [if that makes sense !!!!]

<Do I need A Signature or will an X do?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top