(Msg. 1) Posted: Sun May 25, 2008 5:45 pm
Post subject: Word 2003 Form Help Archived from groups: microsoft>public>word>vba>userforms (more info?)
I have just created my first form-template that incorporates the use of a GUI.
The GUI has been sectioned into three tabs that represents the form in
thirds.
Some of the txt fields are multi-line with EnterKeyBehavior=True.
PROBLEM:
1. When the finish btn is clicked, the click procedure is capturing only the
data in the first tab, thus only populating the first 3rd of the template.
2. The data contained in the txt fields that are multi-lined / EnterKey=True,
Do not populate.
3. ERROR: The range can not be deleted...
QUESTION:
1. Do I have to account for each tab separately in my code in order to
populate the form. If so how?
2. Is it possible to populate a form field with a multi-line property set to
true. If so how?
Thanks in advance for any and all help that may be forthcoming.
--
Regards,
Sean
(Msg. 2) Posted: Mon May 26, 2008 1:56 am
Post subject: Re: Word 2003 Form Help [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
What line does the code stop on when the error occurs? What range is the
code trying to delete?
"Sean Alan" <SeanAlan.RemoveThis@discussions.microsoft.com> wrote in message
news:359E197F-9CCF-4E2C-AFE8-23B7124C5A10@microsoft.com...
>I have just created my first form-template that incorporates the use of a
>GUI.
> The GUI has been sectioned into three tabs that represents the form in
> thirds.
> Some of the txt fields are multi-line with EnterKeyBehavior=True.
>
> PROBLEM:
> 1. When the finish btn is clicked, the click procedure is capturing only
> the
> data in the first tab, thus only populating the first 3rd of the template.
>
> 2. The data contained in the txt fields that are multi-lined /
> EnterKey=True,
> Do not populate.
>
> 3. ERROR: The range can not be deleted...
>
> QUESTION:
> 1. Do I have to account for each tab separately in my code in order to
> populate the form. If so how?
>
> 2. Is it possible to populate a form field with a multi-line property set
> to
> true. If so how?
>
> Thanks in advance for any and all help that may be forthcoming.
> --
> Regards,
> Sean
(Msg. 3) Posted: Mon May 26, 2008 1:56 am
Post subject: Re: Word 2003 Form Help [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Please forgive the crudeness of the code. This is only my second project
using VBE.
The line that reads: ActiveDocument.Bookmarks("Text10").Range.Text =
txtPIName1.Value Is where the code stops.
"Text10" also represents the first text box on the 2nd tab of my user form.
--
Regards,
Sean
"Jonathan West" wrote:
> What line does the code stop on when the error occurs? What range is the
> code trying to delete?
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk > Please reply to the newsgroup
>
>
>
(Msg. 4) Posted: Mon May 26, 2008 3:02 am
Post subject: Re: Word 2003 Form Help [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
I would suggest that you rename all of the bookmarks so that their names
relate to the data that is to be displayed in them. Your code probably
fails to complete because of inconsistencies in the present naming.
I gather that the bookmarks were created by inserting formfields as are used
in a protected document into the template. Rather than doing that, I would
insert { DOCVARIALBE varName } fields and then have your code create
variables in the document that is created from the template and update the
fields in the document so that the data stored in the variables is
displayed.
The code would be:
With ActiveDocument
.Variables("varClient").Value = txtClient.Value
.Variables("varTypeofIncident").Value = cmbTypeofIncident.Value
'Etc.
.Range.Fields.Update
End With
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Sean Alan" <SeanAlan.DeleteThis@discussions.microsoft.com> wrote in message
news:18C42B9A-5125-48E1-B930-D95DD43B1E4A@microsoft.com...
> Please forgive the crudeness of the code. This is only my second project
> using VBE.
>
> Private Sub butnFinish_Click()
> ActiveDocument.Bookmarks("Text34").Range.Text = txtClient.Value
> ActiveDocument.Bookmarks("Dropdown1").Range.Text =
> cmbTypeofIncident.Value
> ActiveDocument.Bookmarks("Dropdown2").Range.Text =
> cmbDayofthe_Week.Value
> ActiveDocument.Bookmarks("Text7").Range.Text = txtRPTName.Value
> ActiveDocument.Bookmarks("Text35").Range.Text = txtRPTAddress.Value
> ActiveDocument.Bookmarks("Text9").Range.Text = txtRPTPhone.Value
> ActiveDocument.Bookmarks("Text10").Range.Text = txtPIName1.Value
> ActiveDocument.Bookmarks("Text11").Range.Text = txtPIAddress1.Value
> ActiveDocument.Bookmarks("Text12").Range.Text = txtPIPhone1.Value
> ActiveDocument.Bookmarks("Text13").Range.Text = txtPIName2.Value
> ActiveDocument.Bookmarks("Text14").Range.Text = txtPIAddress2.Value
> ActiveDocument.Bookmarks("Text15").Range.Text = txtPIPhone2.Value
> ActiveDocument.Bookmarks("Text16").Range.Text = txtPIName3.Value
> ActiveDocument.Bookmarks("Text17").Range.Text = txtPIAddress3.Value
> ActiveDocument.Bookmarks("Text18").Range.Text = txtPIPhone3.Value
> ActiveDocument.Bookmarks("Text28").Range.Text = txtNaritive.Value
> ActiveDocument.Bookmarks("Text29").Range.Text = txtAction.Value
> ActiveDocument.Bookmarks("Text30").Range.Text = txtRepContat.Value
> ActiveDocument.Bookmarks("Text31").Range.Text = txtSOName.Value
> ActiveDocument.Bookmarks("Dropdown3").Range.Text = cmbFollowUp.Value
> Unload Me
> End Sub
>
>
> The line that reads: ActiveDocument.Bookmarks("Text10").Range.Text =
> txtPIName1.Value Is where the code stops.
> "Text10" also represents the first text box on the 2nd tab of my user
> form.
> --
> Regards,
> Sean
>
>
> "Jonathan West" wrote:
>
>> What line does the code stop on when the error occurs? What range is the
>> code trying to delete?
>>
>>
>> --
>> Regards
>> Jonathan West - Word MVP
>> www.intelligentdocuments.co.uk >> Please reply to the newsgroup
>>
>>
>>
(Msg. 5) Posted: Tue Jun 03, 2008 3:42 pm
Post subject: RE: Word 2003 Form Help [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Doug,
I appreciate you knowledge. I spend most of my time looking at your relies.
I made a quick UserForm, put a textbox on it "txtname" and a button
"cmdBtn". I wrote the following code for cmdBtn:
Private Sub CmdBtn1Click()
With ActiveDocument
.Variables("Name").Value = txtName.Value
.Range.Fields.Update
End With
End Sub
I created a field {DOCVARIABLE "Name"\* MERGEFORMAT} on the word document.
When I tried it out, the first time I clicked the button it worked great. I
changed the name in the text box and tried it again and nothing happened. I
closed the userform to go back to the editor; and the name updated on the
Word document. Can you tell me where I went wrong? My object was to change
the name, click the button to show the new name in the Word Document, then do
it again and again.
Thank you
SoCal Rick
(Msg. 6) Posted: Wed Jun 04, 2008 3:05 am
Post subject: Re: Word 2003 Form Help [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
The issue is with the way in which you are showing the userform. You need
to show it Modeless
Use
Dim myform as [yourformname]
Set myform = New [yourformname]
myForm.Show vbModeless
Unload myForm
Set myForm = Nothing
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"SoCal Rick" <SoCalRick DeleteThis @discussions.microsoft.com> wrote in message
news:8D4E7ABD-9B6E-4972-8DC4-E54CD2DCCBBD@microsoft.com...
> Doug,
> I appreciate you knowledge. I spend most of my time looking at your
> relies.
> I made a quick UserForm, put a textbox on it "txtname" and a button
> "cmdBtn". I wrote the following code for cmdBtn:
> Private Sub CmdBtn1Click()
> With ActiveDocument
> .Variables("Name").Value = txtName.Value
> .Range.Fields.Update
> End With
> End Sub
>
> I created a field {DOCVARIABLE "Name"\* MERGEFORMAT} on the word document.
> When I tried it out, the first time I clicked the button it worked great.
> I
> changed the name in the text box and tried it again and nothing happened.
> I
> closed the userform to go back to the editor; and the name updated on the
> Word document. Can you tell me where I went wrong? My object was to
> change
> the name, click the button to show the new name in the Word Document, then
> do
> it again and again.
> Thank you
> SoCal Rick
>
(Msg. 7) Posted: Thu Jun 05, 2008 9:23 am
Post subject: Re: Word 2003 Form Help [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
"Doug Robbins - Word MVP" wrote:
> The issue is with the way in which you are showing the userform. You need
> to show it Modeless
>
> Use
>
> Dim myform as [yourformname]
>
> Set myform = New [yourformname]
> myForm.Show vbModeless
> Unload myForm
> Set myForm = Nothing
>
In his haste, Doug forgot to remove
Unload myForm
Set myForm = Nothing
form the calling Sub...
Rick,
These two lines are standard with modal forms. But, when a modeless form is
displayed, the code in the calling sub continues executing instead of giving
control to the called modeless forms, as is the case with modal form which
will take control and code in the called sub will only resume executing once
the modal form is hidden.
In this case (If we do not remove the aforementioned two lines of code), it
means that as soon as the form is displayed, it is promplty unloaded...
With a modeless form, you need to add
Unload Me
as part of the exit mechanism of the form itself, usually after hiding it
when we are done with it.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum