Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
ericm ericm is offline
external usenet poster
 
Posts: 1
Default A visual basic problem in Word 2003.

I cannot get the value of location 1 (form field "drug1") copied to location
2 (form field "drug2") when the check box (check box "copy1") is checked. I
instead get a blank field at location 2.

The following macro ("UCFCopy1") runs upon exit of the checkbox field :

Sub UCFCopy1()
If ActiveDocument.FormFields("copy1").CheckBox.Value = True Then
ActiveDocument.FormFields("drug2").Result =
ActiveDocument.FormFields("drug1").Result
Else: ActiveDocument.FormFields("drug2").Result = "B"
End If
End Sub

Note that "B" in the above macro is to simply test the value passed through
the macro. When this macro runs and the box is checked, nothing appears in
the form field "drug2" (the text from "drug1" should appear but does not).
When the checkbox is unchecked the form field "drug2" displays "B".

Also note that the screen (on my computer) flashes TWICE when the checkbox
is NOT CHECKED and only flashes ONCE when the checkbox is checked, as though
it is refreshing the contents of the entire screen. I have tried various
variables, declaring variables and removing formatting in the macro/document
without success.

The document in which this macro is executing contains maybe 100 assorted
form fields, checkboxes and field references.

I used the exact same macro in another document I called "filltest" to
simply test the macro's integrity. The "filltest" document consists of
little more than two form fields ("drug1" "drug2") and a checkbox ("copy1").
The macro works there.

Any insight you have would be appreciated.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default A visual basic problem in Word 2003.

The same code functions correctly here.

--
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, originally posted via msnews.microsoft.com

"ericm" wrote in message
...
I cannot get the value of location 1 (form field "drug1") copied to
location
2 (form field "drug2") when the check box (check box "copy1") is checked.
I
instead get a blank field at location 2.

The following macro ("UCFCopy1") runs upon exit of the checkbox field :

Sub UCFCopy1()
If ActiveDocument.FormFields("copy1").CheckBox.Value = True Then
ActiveDocument.FormFields("drug2").Result =
ActiveDocument.FormFields("drug1").Result
Else: ActiveDocument.FormFields("drug2").Result = "B"
End If
End Sub

Note that "B" in the above macro is to simply test the value passed
through
the macro. When this macro runs and the box is checked, nothing appears
in
the form field "drug2" (the text from "drug1" should appear but does not).
When the checkbox is unchecked the form field "drug2" displays "B".

Also note that the screen (on my computer) flashes TWICE when the checkbox
is NOT CHECKED and only flashes ONCE when the checkbox is checked, as
though
it is refreshing the contents of the entire screen. I have tried various
variables, declaring variables and removing formatting in the
macro/document
without success.

The document in which this macro is executing contains maybe 100 assorted
form fields, checkboxes and field references.

I used the exact same macro in another document I called "filltest" to
simply test the macro's integrity. The "filltest" document consists of
little more than two form fields ("drug1" "drug2") and a checkbox
("copy1").
The macro works there.

Any insight you have would be appreciated.



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
ak_edm ak_edm is offline
external usenet poster
 
Posts: 14
Default A visual basic problem in Word 2003.

I'll put the following questions out here for consideration :

1) Would the complexity of a document (e.g. tables, text formatting) affect
the ability for a macro to move variable values from one form field to
another?

2) Would the number of form fields and check-boxes in a document affect the
ability for a macro to retrieve and hold a variable (i.e. the text of a form
field)? For example, maybe Word can only handle a certain number of form
fields, check-boxes, etc... until instability occurs. I ask because that
appears to be the major difference between the document ("filltest") that
works and the other document that doesn't.

3) Is there a way to upload the document in question (Word 2003 doc), so it
can be reviewed? This is a document I use at work, and I've been "ok'd" to
uploaded it if needed.

- Eric


"Doug Robbins - Word MVP on news.microsof" wrote:

The same code functions correctly here.

--
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, originally posted via msnews.microsoft.com

"ericm" wrote in message
...
I cannot get the value of location 1 (form field "drug1") copied to
location
2 (form field "drug2") when the check box (check box "copy1") is checked.
I
instead get a blank field at location 2.

The following macro ("UCFCopy1") runs upon exit of the checkbox field :

Sub UCFCopy1()
If ActiveDocument.FormFields("copy1").CheckBox.Value = True Then
ActiveDocument.FormFields("drug2").Result =
ActiveDocument.FormFields("drug1").Result
Else: ActiveDocument.FormFields("drug2").Result = "B"
End If
End Sub

Note that "B" in the above macro is to simply test the value passed
through
the macro. When this macro runs and the box is checked, nothing appears
in
the form field "drug2" (the text from "drug1" should appear but does not).
When the checkbox is unchecked the form field "drug2" displays "B".

Also note that the screen (on my computer) flashes TWICE when the checkbox
is NOT CHECKED and only flashes ONCE when the checkbox is checked, as
though
it is refreshing the contents of the entire screen. I have tried various
variables, declaring variables and removing formatting in the
macro/document
without success.

The document in which this macro is executing contains maybe 100 assorted
form fields, checkboxes and field references.

I used the exact same macro in another document I called "filltest" to
simply test the macro's integrity. The "filltest" document consists of
little more than two form fields ("drug1" "drug2") and a checkbox
("copy1").
The macro works there.

Any insight you have would be appreciated.




  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default A visual basic problem in Word 2003.

I am pretty certain that the answers to questions 1 and 2 is No. Re 3, send
it to me at

You must remove the uppercase letters to get the correct email address.

--
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, originally posted via msnews.microsoft.com

"ak_edm" wrote in message
...
I'll put the following questions out here for consideration :

1) Would the complexity of a document (e.g. tables, text formatting)
affect
the ability for a macro to move variable values from one form field to
another?

2) Would the number of form fields and check-boxes in a document affect
the
ability for a macro to retrieve and hold a variable (i.e. the text of a
form
field)? For example, maybe Word can only handle a certain number of form
fields, check-boxes, etc... until instability occurs. I ask because that
appears to be the major difference between the document ("filltest") that
works and the other document that doesn't.

3) Is there a way to upload the document in question (Word 2003 doc), so
it
can be reviewed? This is a document I use at work, and I've been "ok'd"
to
uploaded it if needed.

- Eric


"Doug Robbins - Word MVP on news.microsof" wrote:

The same code functions correctly here.

--
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, originally posted via msnews.microsoft.com

"ericm" wrote in message
...
I cannot get the value of location 1 (form field "drug1") copied to
location
2 (form field "drug2") when the check box (check box "copy1") is
checked.
I
instead get a blank field at location 2.

The following macro ("UCFCopy1") runs upon exit of the checkbox field :

Sub UCFCopy1()
If ActiveDocument.FormFields("copy1").CheckBox.Value = True Then
ActiveDocument.FormFields("drug2").Result =
ActiveDocument.FormFields("drug1").Result
Else: ActiveDocument.FormFields("drug2").Result = "B"
End If
End Sub

Note that "B" in the above macro is to simply test the value passed
through
the macro. When this macro runs and the box is checked, nothing
appears
in
the form field "drug2" (the text from "drug1" should appear but does
not).
When the checkbox is unchecked the form field "drug2" displays "B".

Also note that the screen (on my computer) flashes TWICE when the
checkbox
is NOT CHECKED and only flashes ONCE when the checkbox is checked, as
though
it is refreshing the contents of the entire screen. I have tried
various
variables, declaring variables and removing formatting in the
macro/document
without success.

The document in which this macro is executing contains maybe 100
assorted
form fields, checkboxes and field references.

I used the exact same macro in another document I called "filltest" to
simply test the macro's integrity. The "filltest" document consists of
little more than two form fields ("drug1" "drug2") and a checkbox
("copy1").
The macro works there.

Any insight you have would be appreciated.






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic through Word help 4a4i4163211 Microsoft Word Help 0 October 2nd 07 05:22 PM
Problem with Visual Basic A in Word PJay Microsoft Word Help 1 April 9th 07 11:47 AM
how do i solve the problem? visual basic could not be intialized strbreaker Microsoft Word Help 1 September 8th 06 09:38 AM
Can I use visual basic to create wizards in Word 2003? Holly Microsoft Word Help 2 April 3rd 06 08:25 AM
startup of Word 2003 and visual basic and "Subscript out of Range. JDH Microsoft Word Help 1 March 1st 06 05:00 PM


All times are GMT +1. The time now is 08:25 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"