Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-10-2019, 07:56 AM
ashraj0711 ashraj0711 is offline Windows 7 64bit Office 2010
Novice
 
Join Date: May 2019
Posts: 5
ashraj0711 is on a distinguished road
Default Cascading Form Depending on Drop Down Option

Hello,


I am trying to create a referral form on Microsoft Word, in which the content of questions and dropdown answers visible change dependant on the first question and drop down option that is selected.

Can someone let me know if this is possible on word, and if so how I could go about doing it?


Many thanks

ashraj0711
Reply With Quote
  #2  
Old 05-10-2019, 03:14 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,390
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Dependent Dropdown Content Controls
http://www.msofficeforums.com/word-v...html#post77762

Hierarchical Dropdown Content Controls
http://www.msofficeforums.com/word-v...html#post94603
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 05-13-2019, 06:55 AM
ashraj0711 ashraj0711 is offline Windows 7 64bit Office 2010
Novice
 
Join Date: May 2019
Posts: 5
ashraj0711 is on a distinguished road
Default Referral Form - Check Box

Hi Macropod,


Sorry, I don't think I am explaining myself very well and i'm very new to using Macros.

I have attached a draft version of the form I am trying to create. Essentially, dependent on which services are selected/checked under Heading 1 (Service): I want the boxes only with that heading being displayed under heading 5.

Is that possible / how would I go about doing this?

(Hope that makes sense)


Thanks in advance for your help!

ashraj0711
Attached Files
File Type: docx Combined Referral Form.docx (43.6 KB, 5 views)
Reply With Quote
  #4  
Old 05-13-2019, 03:32 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,390
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

That is a rather different proposition. I would suggest creating custom Quick Parts for each of the options, which would be stored in the document's template (you might want to create a specific Word template for this). The template should be based on the basic layout, with a series of consecutive bookmarks, one for each option. A ContentControlOnExit macro could then be used to automatically insert/remove each Quick Part in accordance with the checked state of the corresponding checkbox.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 05-15-2019, 07:11 AM
ashraj0711 ashraj0711 is offline Windows 7 64bit Office 2010
Novice
 
Join Date: May 2019
Posts: 5
ashraj0711 is on a distinguished road
Default

Hi Paul,

Thanks for the above.

I've created a custom quick park as discussed and I am running the following code:

Private Sub CheckBox1_Click()

If CheckBox1.Value = True Then

'
' AdultCommunityDiabetesReasonForReferral Macro
' Adult Community Diabetes Reason for Referral
'
Application.Templates( _
"C:\Users\ThurairajA\AppData\Roaming\Microsoft\Doc ument Building Blocks\1033\14\Building Blocks.dotx" _
).BuildingBlockEntries("AdultCommunityDiabetes").I nsert Where:=Selection. _
Range, RichText:=True

Else: End If

End Sub


However, it seems the custom quick part is saved to my temporary files and not the actual document itself. How would I go about ensuring its part of the template?

Also the Macro I am running inserts the quick part exactly where the checkbox is: could you let me know how to code the position at which I want the macro to run?

thanks

Ash

Thanks

Ash
Reply With Quote
  #6  
Old 05-15-2019, 04:02 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,390
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by ashraj0711 View Post
However, it seems the custom quick part is saved to my temporary files and not the actual document itself. How would I go about ensuring its part of the template?
Quick parts are always added to a template, never to the document itself. Moreover, you can choose which template they're added to. Your code shows the Quick Part was added to Word's Building Blocks.dotx template.
Quote:
Originally Posted by ashraj0711 View Post
Also the Macro I am running inserts the quick part exactly where the checkbox is: could you let me know how to code the position at which I want the macro to run?
As I said, you create a bookmark in the document and insert the Quick Part there. To do that, you might replace:
Where:=Selection. _
Range
with:
Where:=ActiveDocument.Bookmarks("AdultCommunityDia betes").Range
where 'AdultCommunityDiabetes' is the bookmark name.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 05-16-2019, 01:36 AM
ashraj0711 ashraj0711 is offline Windows 7 64bit Office 2010
Novice
 
Join Date: May 2019
Posts: 5
ashraj0711 is on a distinguished road
Default

Hi Paul,

thanks for the above.

I have now got the code below working but only on my computer. I think the issue is in where I have highlighted red: I think I need to find a way for this path to always be the active document so that the macros work correctly when I send the document to other users.

Any idea how I can do this?


Private Sub CheckBox1_Click()

Selection.EndKey Unit:=wdStory

If CheckBox1.Value = True Then

'
' AdultCommunityDiabetes Macro
'
'
Application.Templates( _
"H:\Coding Files\Referral Form Combined (Template).dotm"). _
BuildingBlockEntries("AdultCommunityDiabetes").Ins ert Where:=Selection. _
Range, RichText:=True

Else: End If

Selection.HomeKey Unit:=wdStory

End Sub



Thanks

Ash
Reply With Quote
  #8  
Old 05-16-2019, 01:43 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,390
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

As I said in post 4:
Quote:
Originally Posted by macropod View Post
TI would suggest creating custom Quick Parts for each of the options, which would be stored in the document's template (you might want to create a specific Word template for this). The template should be based on the basic layout, with a series of consecutive bookmarks, one for each option. A ContentControlOnExit macro could then be used to automatically insert/remove each Quick Part in accordance with the checked state of the corresponding checkbox.
If you want to distribute the functionality you really do need to create a suitable template - with the macros pointing to that template - and distribute the template.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #9  
Old 05-16-2019, 03:50 AM
ashraj0711 ashraj0711 is offline Windows 7 64bit Office 2010
Novice
 
Join Date: May 2019
Posts: 5
ashraj0711 is on a distinguished road
Default ContentControlOnExit Macro

So I've done what you've said and created a template using a dotm file and created custom quick parts but the same problem arises.

I am not 100% sure what you mean by use a ContentControlOnExit Macro. Could you please explain this further?

I've attached the updated template if that helps.

Again, many thanks for your help!

Ash
Attached Files
File Type: dotm Referral Form Combined (Template) - (ver2.0).dotm (187.1 KB, 3 views)
Reply With Quote
  #10  
Old 05-16-2019, 02:57 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,390
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

It seems you like creating moving targets. You original document had content control checkboxes. The template in your latest attachment has ActiveX checkboxes. The links in post #2 both demonstrate possible uses of a ContentControlOnExit macro. It also appears you still haven't added any of your Quick Parts to this template.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Tags
dependent, drop down, referral form

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cascading Drop Down and23 Word VBA 8 05-23-2018 02:33 PM
Userform with Multiple Cascading Drop Down Lists Populated with External Source Data venganewt Word VBA 21 05-16-2018 02:05 PM
Word document with text depending on drop down list option miguelcane Word VBA 1 04-30-2018 06:51 PM
Issue Using Word Document with Cascading Drop Down Lists LynnMac2016 Word VBA 3 04-06-2016 06:15 AM
Create a fillable form that changes a paragraph depending on what is chosen in a drop down list. Sullivanaudio Word VBA 1 03-31-2015 10:45 PM


All times are GMT -7. The time now is 10:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft