Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2014, 08:43 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: 22,343
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

The running of the Update macro is controlled by the Checkbox - it's properties show the macro is assigned to the formfield's Exit event.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 03-07-2014, 12:18 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: 872
Ulodesk is on a distinguished road
Default Some success, believe it or not

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.

I realize and respect that code is as plain as English to you, but since the mechanics of all this still remain obscure to me, an hour of attempts has failed in creating a first additional check box and includetext field to add additional bookmarked text from the source doc. I simply don’t know what to change, though I thought I had grasped the process.

I have, strangely, been able to repeat exactly what the field you created does, with the same text brought in, even though I created a CheckNo2 custom document property, and two more bookmarks with another paragraph and another empty one. 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.

If I may ask you to once again correct my error, perhaps I can see where the difference lies and use that for all the additional check boxes and future documents I need to create.

Best,
Philip
Reply With Quote
  #3  
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: 22,343
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, 18 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
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: 872
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, 17 views)
File Type: docx Quick ref table.docx (20.2 KB, 12 views)
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 03:08 PM.


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