Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]() |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic through Word help | Microsoft Word Help | |||
Problem with Visual Basic A in Word | Microsoft Word Help | |||
how do i solve the problem? visual basic could not be intialized | Microsoft Word Help | |||
Can I use visual basic to create wizards in Word 2003? | Microsoft Word Help | |||
startup of Word 2003 and visual basic and "Subscript out of Range. | Microsoft Word Help |