Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2014, 05:53 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: 788
Ulodesk is on a distinguished road
Default Setting up a form to bring in text for other documents

I am having problems with a macro from Greg Maxey's site. I can't get the text to come into the document. The requirement is simple. I'm creating a document which will have a number of items listed, each with a check box. The idea is that when a checkbox is checked, the exit macro grabs text from a corresponding document and inserts it at a book mark on a subsequent page.
I created two word docs, Text1 and Text2 on the desktop. Each has just a paragraph or two in it. I copied Greg's macro into my normal template,and replaced his document location and names with mine. I created a trial check box, created a bookmark on the next page, and restricted editing to filling out forms, according, I thought, to his directions on the site page I have now spent 30 minutes looking for and cannot find; it's not in my browser history and no search turns it up.



Anyway, the text is not being brought in.
I am attaching the trial document and the code is below. I have with heavy irony, inserted the name Genius instead of the real user name in the path. I hope someone can quickly spot my error.

Code:
Sub OnExitCB1()
Dim rText As Range
Dim sTrue As String
Dim sFalse As String
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
sTrue = """C:\\Users\\Genius\\Desktop\\Text1.docx"""
sFalse = """C:\\Users\\Genius\\Desktop\\Text2.docx"""
Set rText = ActiveDocument.Bookmarks("Check1Result").Range
If oFld("Check1").CheckBox.Value = True Then
rText , wdFieldIncludeText, sTrue, False
rText.MoveEnd wdCharacter, 1
Else
rText.Fields.Add rText, wdFieldIncludeText, sFalse, False
rText.MoveEnd wdCharacter, 1
End If
With ActiveDocument
.Bookmarks.Add "Check1Result", rText
.Fields.Update
End With
End Sub
Attached Files
File Type: docx Form page.docx (17.0 KB, 5 views)
Reply With Quote
  #2  
Old 02-23-2014, 07:00 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: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Personally, I'd have the INCLUDETEXT fields in the document already, and use a DOCPROPERTY field to return a value from a custom document property to determine the output. If the source documents have two bookmarked ranges - one containing the TRUE content and the other containing the FALSE content - all that is needed is to toggle the bookmark reference. For example:
{INCLUDETEXT "C:\\Users\\Genius\\Desktop\\Text1.docx" "{DOCPROPERTY BkMk}"}

Alternatively, if you want two separate documents, use the DOCPROPERTY field to toggle the 1/2 in the document names. For example:
{INCLUDETEXT "C:\\Users\\Genius\\Desktop\\Text{DOCPROPERTY DocID}.docx"}

Either way, you don't need to rely on updating bookmarked ranges in your form document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-25-2014, 09:27 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: 788
Ulodesk is on a distinguished road
Default Far afield

Gentlemen, thank you. I am getting nowhere, through no fault of yours, of course. I am so far unable simply to get the Includetext field to do anything but return an "invalid file name" message. So far, my research on the field syntax is completely unproductive, so I'll probably have to wait till the weekend.

Just to explain briefly, I tried the code Paul indicated, with the full path name, and with various attempts, based on that and MS support pages, to include or not include a bookmark in various ways.

At present, I have, on my desktop, a folder, "Form", in which are my "form" document and Text1.docx, the latter with two bookmarks, Check1 and Check 2, the first a paragraph, the second an empty paragraph, for the unchecked box return as I think I understood your suggestion.

The MS page, perhaps outdated, indicates no need for a full document path in the include text field, but full or not, as I said, and with as much careful scrutiny of this unfamiliar syntax as I can give, no luck.

I'll get back to you once I have done some more homework.

Best, Philip
Reply With Quote
  #4  
Old 02-25-2014, 09:33 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: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

If you're referring to either of these:
{INCLUDETEXT "C:\\Users\\Genius\\Desktop\\Text1.docx" "{DOCPROPERTY BkMk}"}
{INCLUDETEXT "C:\\Users\\Genius\\Desktop\\Text{DOCPROPERTY DocID}.docx"}
then:
1. The field brace pairs (ie '{ }') are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from a post.
2. Your document would need the Custom Document Property named BkMk or DocID, as appropriate, to exist and have a valid value.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-26-2014, 09:24 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: 788
Ulodesk is on a distinguished road
Default

Thank you. I do realize that field braces cannot be typed. For the basic field, I tried just
{INCLUDETEXT "C:\\Users\\Genius\\Desktop\\Text1.docx"}
as well as
{INCLUDETEXT "C:\\Desktop\\Text1.docx"}
with the same failure result.

I would also note that in some instructions, I see the bookmark in the source doc enclosed in regular, not curly braces. These are aspects of syntax that I think I need to research, rather than simply troubling you with a linear series of questions; I need to get a better overall grasp of fields first.

Cordially,
Philip
Reply With Quote
  #6  
Old 02-26-2014, 02:23 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: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Well, that has nothing to do with the approach I suggested, but with the fact your INCLUDETEXT field points to a path and/or document that doesn't exist. The string
Code:
"C:\\Users\\Genius\\Desktop\\Text1.docx"
is taken from the code you posted. Of course, one has to bearing in mind your comment that you:
Quote:
inserted the name Genius instead of the real user name in the path
and, because of this, we aren't in a position to know the true file path & name.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-27-2014, 08:45 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: 788
Ulodesk is on a distinguished road
Default

Gents,
I am back again, having failed to find any tutorials addressing my issue, and being unable to understand your instructions, due to my lack of knowledge of fields. There must be somewhere to learn about this, but I have been unable in hours of searching to find it. I meant to check the local (real) library tonight for a copy of a recent Office Bible, but didn't make it. Again, if you have links to the information I need, I am glad to do my own homework.

That said, I am attaching a source and a target document, the latter with notes about its content. The source is "Text1", the target is "Form page". I explain their location on my machine, below. I haven’t even gotten to trying the checkbox, as explained in my original post, again. I am simply trying to get an INCLUDETEXT field to work with a bookmark. I have not found a single source among pages of searches that explains how the bookmark is to be included.

The source and target docs reside in the same folder on my desktop. By using Word's Insert/QuickParts/Field, I finally got a field that would bring in the text from the source. All the text. However, as you'll see in the source doc, I have created two bookmarks: Check1 comprising the first two paragraphs, Check2 the empty paragraph which follows. The final paragraph is not bookmarked. The Check1 and 2 would presumably correspond to a checked and unchecked legacy form tools check box, respectively — when I get that far. Meanwhile, I cannot find a way to include the name Check1 in the INCLUDETEXT field and get it to work, i.e., to bring in only the bookmarked text. At one point, I managed to include it and the field worked, rahter than returning an "invalid filename" message, but it ignored the bookmark and simply brought in all the text from the source as if it had not been there at all. I have been simply typing the name Check1 in the field, for instance:

Code:
{ INCLUDETEXT  "Text1.docx"  Check1 }
Paul has said that the source document would need to have a custom document property created in it. Maybe I just need a course in web searches; I don’t usually have this much trouble expanding my knowledge of Word. I found one source allegedly specific to Word 2013—with illustrations from 2007. I cannot for the life of me find where or how to create a custom document property in 2013 -- nowhere in File/Info or Document Panel, which offers only Standard Properties as a category in the drop-down -- nor have I been able to find even meaningful text discussing custom document properties (I understand normal ones such as author, word count, etc., in principle at least) and how to create one. In the fields list, there is a DocProperty, of course, but nothing called Custom or with either of the names Paul gave. So, I'm afraid that even if I did find instructions on where this command/link/dialogue is, I wouldn’t know how to proceed to implement your kind advice.

I apologize for belaboring this. It is perhaps an attempt to say, I'm not a complete incompetent at Word, and this surely is not a complex issue, but it surely has me baffled!

Cordially,
Philip
Attached Files
File Type: docx Form page.docx (25.7 KB, 2 views)
File Type: docx Text1.docx (17.4 KB, 4 views)
Reply With Quote
  #8  
Old 02-28-2014, 12:05 AM
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: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Here's a copy of your 'Form page' document back, with:
1. a custom document property named 'CheckNo'; and
2. the INCLUDETEXT field with a:
(a) FILENAME field being used to generate a relative path to the Test1.docx file. Simply omitting the path is not reliable;
(b) bookmark reference to your Test1.docx file's Test bookmarks; and
(c) DOCPROPERTY field referencing the 'CheckNo' custom document property to vary the bookmark number. Currently it refers to Test bookmark #1.

Simply save the file to the same folder as your Test1.docx file and everything should work fine. If you change the 'CheckNo' custom document property value from 1 to 2 and update the INCLUDETEXT field (e.g. via Alt-A, F9), the document content will change to reflect whatever is in the Test2 bookmark. If you edit the content of either bookmark and update the INCLUDETEXT field the reference will also update.

To change the 'CheckNo' custom document property value, go to File>Properties>Advanced properties>Custom.
Attached Files
File Type: docx Form page.docx (16.6 KB, 31 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 03-01-2014, 06:06 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: 788
Ulodesk is on a distinguished road
Default Definite progress, but more trouble

Thank you very much, Paul. I have studied the complex field you returned, found the advanced document properties, and have successfully changed the value of the custom property as well as the source document; that is, I know how now. I have learned a good deal in the process and I am very grateful! But still stuck.

What I am now stumped on is how to use this with a checkbox. I am attaching a copy of the document you provided, with a better indication of what I would like to end up with, in case I have not communicated this aspect clearly. A corresponding source doc (Text1) is also attached.

I have cast it in terms of computer help desk sorts of issues, with two examples and the rest left as generic labels. I have set this up in a table in the target doc; I believe tables cause no problems in this regard but can lay out the page otherwise. The idea is simply that on page one, I have a list of issues I recognize by a label. The source document contains the solutions to every issue, each one separately bookmarked.

Let's say, for example, that I have a client who needs solutions for issues 1,4,7, and 13. I open my target doc, and as I check the relevant check boxes, those selected solutions are brought in on page two, which I then print out and hand to my client. That's the principle.

I remain confused about how this would work in your plan. In your early response above, you said

Quote:
Personally, I'd have the INCLUDETEXT fields in the document already, and use a DOCPROPERTY field to return a value from a custom document property to determine the output. If the source documents have two bookmarked ranges - one containing the TRUE content and the other containing the FALSE content - all that is needed is to toggle the bookmark reference. For example:
{INCLUDETEXT "C:\\Users\\Genius\\Desktop\\Text1.docx" "{DOCPROPERTY BkMk}"}
I can find "toggle field codes" but not "toggle bookmark references". Also, I have trouble translating that to what you have provided. True and False, I guess would correspond to checked and unchecked, respectively? Or,would I make, perhaps, two bookmarks in the source doc for each solution, the first with the solution, the second an empty paragraph, and the empty para would correspond to the unchecked box, the solution to the checked box. I can't figure that one out, because I have to manually change the custom document property value; so, even if I created 20 custom document properties to refer to 20 bookmarked solutions, changing each would still be manual. Obviously, there's something else.

The Graham Mayor page I had lost, that goes through his solution, is here: http://www.gmayor.com/selectfile.htm About halfway down the page, where it says INCLUDETEXT field.

His uses a macro, which he provides, on exit from checking a box to insert the desired text at a bookmark. Presumably the bookmark stays empty until a box is checked. Though I haven't gotten there yet, I would think that then I could create macro to delete any empty paragraphs or something like that, to avoid extra space between solution paragraphs for the printed copy.

Paul, I'm not trying to suggest reversion to an approach you have replaced; I just don't grasp the connections here. I had no idea this would require so much time.

Cordially,
Philip
Attached Files
File Type: docx Form page with more indicators.docx (30.1 KB, 7 views)
File Type: docx Text1.docx (18.2 KB, 4 views)
Reply With Quote
  #10  
Old 03-02-2014, 03:37 AM
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: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Quote:
Originally Posted by Ulodesk View Post
What I am now stumped on is how to use this with a checkbox.
If you're using checkboxes, you don't need either custom document properties or DOCPROPERTY fields, though they can still be used. For example, instead of using either custom document properties or DOCPROPERTY fields, you could use
{INCLUDETEXT "{FILENAME \p }/../Text1.docx" "Check{IF{REF Check1}= TRUE 2 1}"}
Using checkboxes does required a macro but, given you document is using formfields, you could use dropdown formfields for the same purpose and that would not require a macro.
Quote:
Let's say, for example, that I have a client who needs solutions for issues 1,4,7, and 13. I open my target doc, and as I check the relevant check boxes, those selected solutions are brought in on page two, which I then print out and hand to my client. That's the principle.
In that case, it's a simple matter of having one per checkbox. For example:
{INCLUDETEXT "{FILENAME \p }/../Text1.docx" "Check1{IF{REF Check1}= TRUE 2 1}"}
{INCLUDETEXT "{FILENAME \p }/../Text1.docx" "Check2{IF{REF Check2}= TRUE 2 1}"}
{INCLUDETEXT "{FILENAME \p }/../Text1.docx" "Check3{IF{REF Check3}= TRUE 2 1}"}
(Note the additional number in the bookmarks to cater for the additional checkboxes; you could just as easily use letters or something else - you could even replace the outer 'Check1', 'Check2', etc with meaningful names). The important thing to remember is that you need two bookmarks per checkbox - one for whatever is to be output for the True value and one for the False value, even if one of those is empty. You can even add more logic for what happens if two particular checkbox values are true, for example.
[quote]I can find "toggle field codes" but not "toggle bookmark references".
The toggling referred to consisted of changing the value between 1 & 2 (though you could use 0 & 1 to 'equate' to False & True); this has nothing to do with toggling the field code display.
Quote:
I had no idea this would require so much time.
The time investment is largely because you're getting into an area few people work with and is poorly documented. In reality, mastering what can be achieved via field codes is no more difficult than achieving a similar level of proficiency in postscript programming, for example (I've done that, too).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 03-05-2014, 09:40 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: 788
Ulodesk is on a distinguished road
Default My dense fog

Like someone given a fine 35mm camera who doesn’t know what a film advance does and therefore can’t make the machine work, I return yet again after another couple of hours of trying to make your undoubtedly perfect your code work, stumbling around without being able to find answers to my searches on VBA syntax. Perhaps I just named things in a bad way that increases my confusion. So, if I may, here is a new attempt with the same example, using a naming system that could work for my project as it expands.

As before, all docs are on my desktop in a folder called Form. I have named the target document Target, the source document Source1, and the two bookmarks in Source1 -- standing, respectively, for Source1 Bookmark1 True and False -- are S1B1T and S1B1F, the latter an empty paragraph to correspond to an unchecked check box.

You said “a macro” is needed for checkboxes, so I assume you refer to Graham Mayor’s at the site I linked. Check1 presumably refers to check box 1 in Target. His macro appears to automatically create a bookmark called Check1, which baffles me, because it seems this would be what I create as the bookmark enclosing the includetext field on page two. I have tried to adapt his example to my situation. It seems to me that the sTrue and sFalse lines need to include the names of the two bookmarks (he uses two separate documents), but I don’t know how to properly insert them (somewhere within the triple quotation marks?). I can only guess that rText (return text?) refers to my includetext field, but I’m lost with the code.
Code:
Sub OnExitCB1()
 Dim rText As Range
 Dim sTrue As String
 Dim sFalse As String
 Dim oFld As FormFields
 Set oFld = ActiveDocument.FormFields
 sTrue = """C:\\Desktop\\Form\\Source1.docx"""
 sFalse = """C:\\Desktop\\Form\\Source1.docx"""
 Set rText = ActiveDocument.Bookmarks("Check1Result").Range
 If oFld("Check1").CheckBox.Value = True Then
 rText , wdFieldIncludeText, sTrue, False
 rText.MoveEnd wdCharacter, 1
 Else
 rText.Fields.Add rText, wdFieldIncludeText, sFalse, False
 rText.MoveEnd wdCharacter, 1
 End If
 With ActiveDocument
 .Bookmarks.Add "Check1Result", rText
 .Fields.Update
 End With
 End Sub
Then, looking at the code you provided,

Code:
{INCLUDETEXT "{FILENAME \p }/../Text1.docx" "Check1{IF{REF Check1}= TRUE 2 1}"}
I have for clarity changed the first instance of Check1 to Field1, assuming that this refers to the bookmark I assign to the entire field, so that the status of the check box brings in either S1B1T or S1B1F. I don’t understand “TRUE 2 1”. TRUE means, I guess, that the check box is checked;I don’t understand what the numbers do.

I would think that, for starters, it should be, in my case,

Code:
{INCLUDETEXT "{FILENAME \p }/../Source1.docx" "Field1{IF{REF Check1}= TRUE 2 1}"}
but I don’t see how it would choose one of the two bookmarks in the source document.

In case I'm proceeding wrong: After creating Source, my procedure in Target has been to create the include text field and get that to work (at least, bringing in the entirety of Source1). Then I try to modify the field, successively including the additional sub-fields and typed text. This is where I start getting "bookmark not defined" errors. With Mayor's macro already installed, then I try inserting the legacy checkbox, following Mayor's settings.

I am determined to make this work, and repeat my thanks for all your help.
Reply With Quote
  #12  
Old 03-05-2014, 07:40 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: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

See attached. I've reverted to using the custom document property in conjunction with the checkbox, as that's simpler to implement with the required macro. As you'll see, the macro is pretty simple; it's also easily converted to use with a checkbox content control, for example.

Simply extract both files to a common folder.
Attached Files
File Type: zip CheckBox Conditional Text.zip (30.2 KB, 11 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 03-05-2014, 08:15 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: 788
Ulodesk is on a distinguished road
Default What might be keeping the macro from running?

Paul, thank you. I can imagine you are tired of hearing about this one, and only wish I could give something in return.

I see that your Update macro is specific to the Form page.docm, that is, it is in a different module from the rest of my macros. It is not running; that is, whether I check the check box or uncheck it, nothing appears to happen; no text from Text1 comes in, nothing moves.

If I unprotect the document temporarily, I can run the macros I have in my normal.dotm. Could there be some setting I have that's preventing yours from running?

Cordially,
Philip
Reply With Quote
  #14  
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: 20,488
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
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
  #15  
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: 788
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
Reply

Thread Tools
Display Modes


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 - Senior Forums

All times are GMT -7. The time now is 08:27 PM.


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