Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2004

Tip: Looking for answers? Try searching our database.

Getting Submit Button to work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Diona Austill - 29 Jan 2004 19:49 GMT
I'm trying to make a form that a user can pull up, fill
out, and submit that will have fields to fill out the
Word document. I have the text below in my submit button
and it will not work. I used a sample from the MV page
but it still won't work.  Any ideas? It might be because
it doesn't explain what should go between the "" and I
might not have the right info there.

Thanks,

Private Sub CommandButton1_Click()
With ActiveDocument
ActiveDocument.Bookmarks("Requested").Range.InsertBefore _
 "Text1"
ActiveDocument.Bookmarks("Equip").Range.InsertBefore _
 "Textw"
ActiveDocument.Bookmarks("Location").Range.InsertBefore _
 "Texte"
ActiveDocument.Bookmarks
("Manufacturer").Range.InsertBefore _
 "Text4"
ActiveDocument.Bookmarks("Model").Range.InsertBefore _
 "Text5"
ActiveDocument.Bookmarks("Serialnum").Range.InsertBefore _
 "Text6"
ActiveDocument.Bookmarks("problem").Range.InsertBefore _
 "Text7"
End With

UserForm1.Hide

End Sub
Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS - 29 Jan 2004 21:09 GMT
Hi Diona

The Text1,  Textw, Texte, thru Text7 would be the names of textbox controls
on your userform.  I suggest that to make it easier to follow, you rename
those controls to have the same name as the bookmark into the range of which
the information from the control is to be inserted.  I assume that you do
have the bookmarks in the template as you have not mentioned getting the
error message that you would receive if they were not present.

I assume also that the submit button still has the name CommandButton1 and
that submit is just the Caption on the button.

Do you get an error message at all, or does just nothing happen?

If you can't sort it out, send a copy of the template to me by emai quoting
this reference in the subject line "Diona Austill 20040130"
Signature

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP

> I'm trying to make a form that a user can pull up, fill
> out, and submit that will have fields to fill out the
[quoted text clipped - 28 lines]
>
> End Sub
- 30 Jan 2004 18:08 GMT
Doug

I have tried emailing you but I keep getting them back.
The form is now putting 'TextBox1' into the form, not the
text in the form. I also added the routingslip method but
it didn't seem to do anything after the userform closed.
Let me know an email address that works and I'll send you
the template. You can email me at
diona@larrl.ars.usda.gov.

Thanks,

>-----Original Message-----
>Hi Diona
[quoted text clipped - 30 lines]
>>  "Textw"
>> ActiveDocument.Bookmarks
("Location").Range.InsertBefore _
>>  "Texte"
>> ActiveDocument.Bookmarks
[quoted text clipped - 3 lines]
>>  "Text5"
>> ActiveDocument.Bookmarks
("Serialnum").Range.InsertBefore _
>>  "Text6"
>> ActiveDocument.Bookmarks("problem").Range.InsertBefore _
[quoted text clipped - 6 lines]
>
>.
Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS - 31 Jan 2004 00:36 GMT
Hi Diona,

Where did "TextBox1" come from?  Before we were talking about Text1, Textw,
Texte, etc.

Did you de-spam my email address.  You will need to send it to
dkratmvps.org, replacing the at with the usual symbol.

Signature

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps

> Doug
>
[quoted text clipped - 85 lines]
>>
>>.
Peter Hewett - 29 Jan 2004 21:15 GMT
Hi Diona

If all you are trying to do is update the bookmarks in your document try
the following code:

Sub UpdateBookmarkedText(ByVal Bookmark As String, _
                        ByVal Value As String)
   Dim rngBookmark As Word.Range

   With ActiveDocument.Bookmarks
       If .Exists(Bookmark) Then
           Set rngBookmark = .Item(Bookmark).Range
           rngBookmark.Text = Value
           .Add Bookmark, rngBookmark
       End If
   End With
End Sub

I'm assuming that "Text1", "Textw" are the names of the TextBox controls on
your form?

If that's the case then you can replace:

   ActiveDocument.Bookmarks("Requested").Range.InsertBefore "Text1"
with:
   UpdateBookmarkedText "Requested", Text1.Value

and the same for the other bookmarks you need to update.

HTH + Cheers - Peter

> I'm trying to make a form that a user can pull up, fill
> out, and submit that will have fields to fill out the
[quoted text clipped - 28 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.