Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 03-07-2014, 02:52 PM
macropod's Avatar
macropod macropod is offline Setting up a form to bring in text for other documents Windows 7 32bit Setting up a form to bring in text for other documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Ulodesk View Post
Thank you again.

After a half hour of trial and error, I discovered that the way to have the bookmarked text from Text1 come in when the checkbox is checked, rather than unchecked, was to remove from the macro the " + 1" at the end of the line

Code:
.CustomDocumentProperties("CheckNo").Value = .FormFields("Check1").Result + 1
This solution—the only one I could make work—now returns (if that's the right term)

Error! Bookmark not defined

when the box is unchecked, but I can live with that. I had just thought that it would return nothing, i.e., the empty paragraph of the second bookmark..
The correct way to do that in this case is to change what the bookmarks in the source document refer to - simply swap their ranges around.

Doing it the way you did means the field then looks for a bookmark named Check0 in the source document. If you were to add one, the error would go away.


Quote:
I tried duplicating the Update macro as Update2 and changing the line shown above to
Code:
.CustomDocumentProperties("CheckNo2").Value = .FormFields("Check2").Result
to, I thought, correspond to the new references, but that crashed the document without producing the desired result.
Did you also create the new custom document property to go with it? And the corresponding bookmarks in the source document?

Attached is an update to the demo files. the destination file now has two checkboxes, updating Custom Document Properties CheckA & CheckB that the INCLUDETEXT fields now refer to, for the purposes of retrieving bookmarks Check1, Check2, Check3 & Check4 from the source file.
Attached Files
File Type: zip CheckBox Conditional Text.zip (31.4 KB, 16 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #17  
Old 03-08-2014, 01:29 PM
Ulodesk Ulodesk is offline Setting up a form to bring in text for other documents Windows 7 64bit Setting up a form to bring in text for other documents Office 2013
Word 2013 Expert Cert
Setting up a form to bring in text for other documents
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default So very close!

I hope you can still laugh, rather than mutter something, at my evident talent for confusion. Your latest explanation was very helpful. Over the last couple of hours, I have looked carefully at all the variables, simplified the document to make it clearer for me, and tried to get everything exactly right. I have apparently only one small issue remaining.

Let me explain first, that the source doc now has four paragraphs, bookmarked 1-4 in order: 1 & 3 have English text with their respective bookmark numbers, 2 & 4 are empty. I have been over and over the macros, the doc properties, and the checkbox properties and can't solve the following mystery (I am attaching a quick reference table of settings that I hope will save you the time of looking into the folder containing my current documents.):

If checkbox 1 brings in the text when checked, it brings in paragraph 3, not 1. The result is the same as checking checkbox 2. When I get checkbox 1 to bring in paragraph 1, as it should, it will only do it when it is unchecked; the checked state brings in a blank. OK, how am I doing this:

Your last response explained how to change the value of "+ (digit)" at the end of the macro line, to reverse the checked and unchecked results. Checkbox 2 works fine this way with that value as 2. However, if the value in the macro for checkbox 1 is 2, it returns paragraph 3; if the value is one, it returns paragraph one, but only when unchecked.

In the attached folder, I have left both boxes unchecked, with checkbox 1 returning paragraph 3.

Please, what am I not seeing here?

Cordially,
Philip
Attached Files
File Type: zip CheckBox Conditional Text (2).zip (34.0 KB, 15 views)
File Type: docx Quick ref table.docx (20.2 KB, 10 views)
Reply With Quote
  #18  
Old 03-08-2014, 03:09 PM
macropod's Avatar
macropod macropod is offline Setting up a form to bring in text for other documents Windows 7 32bit Setting up a form to bring in text for other documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

OK, so you have two checkboxes (CheckA & CheckB) and four bookmarks (Check1, Check2, Check3 & Check4).
Using the solution I provided in my last post:
1. CheckA references Check1 when unchecked and Check2 when checked; and
2. CheckB references Check3 when unchecked and Check4 when checked.

You want to invert the behaviour. There are at least four ways of doing this that come to mind. Using the solution I provided in my last post, you could either:
1. swap the bookmarks around in the source document, so that -
• Check1 applies to what Check2 now applies to, and vice versa; and
• Check3 applies to what Check4 now applies to, and vice versa; or
2. modify the macros so that -
• .FormFields("Check1").Result + 1 becomes 2 - .FormFields("Check1").Result; and
• .FormFields("Check2").Result + 3 becomes 4 - .FormFields("Check2").Result; or
3. modify the source document and modify the macros thus:
• add an empty bookmark named Check 0 to the source document;
• change '.FormFields("Check1").Result + 1' to '.FormFields("Check1").Result'; and
• change '.FormFields("Check2").Result + 3' to '.FormFields("Check2").Result +2'; or
4. modify the source document and modify the macros thus:
• add an empty bookmark named Check 0 to the source document;
• re-assign the Check2 bookmark to range now spanned by Check4;
• delete the Check3 & Check4 bookmarks; and
• change '.FormFields("Check1").Result + 1' to '.FormFields("Check1").Result * 1'; and
• change '.FormFields("Check2").Result + 3' to '.FormFields("Check2").Result * 2'.

The reason I refer to the solution I provided in my last post is that, in your attachment, you've edited the macros so that both refer to their formfield result '+ 2', which means their INCLUDETEXT fields point to the same boomarks in the source document...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #19  
Old 03-09-2014, 09:57 AM
Ulodesk Ulodesk is offline Setting up a form to bring in text for other documents Windows 7 64bit Setting up a form to bring in text for other documents Office 2013
Word 2013 Expert Cert
Setting up a form to bring in text for other documents
 
Join Date: Sep 2009
Location: Virginia
Posts: 866
Ulodesk is on a distinguished road
Default Final

Dear Paul,
With some work, I did manage to get one of your several instructions to function in the previous document. You have been extremely patient and generous with your time -- above and beyond, as the phrase goes -- and it is my own mental blocks to grasping the operations that have drawn this out so long. I am quite at home with multiple variables in other realms, such as photographic controls, but I have a terrible time understanding the relations of between the macro, document properties, form fields, and bookmarks. I shall just have to keep working at it, with printouts of your posts and a calm attitude.

I hope I may some day return the favor, if not directly to you, perhaps by helping someone else with something I do understand.

Best wishes,
Philip
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up a form to bring in text for other documents Divide Word Form into two separate documents mortcr Word VBA 1 10-22-2013 02:02 PM
Setting up a form to bring in text for other documents Best options for setting tab order in a form DBrooks Word 1 02-16-2013 01:32 PM
Setting up a form to bring in text for other documents Form field selection allows entry into form text box David C Word 1 10-24-2012 04:53 AM
Setting up a form to bring in text for other documents problems saving Word documents in .pdf form kellyjb27 Word 1 05-26-2012 11:08 AM
Setting up a form to bring in text for other documents Form Fields - Create blank form text field with if statement? LAssist2011 Word 5 12-14-2011 03:02 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft