Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2020, 08:55 AM
shanerolle shanerolle is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2019
Novice
Auto Create/Format a Word Document based on Check Boxes
 
Join Date: Apr 2020
Posts: 10
shanerolle is on a distinguished road
Default Auto Create/Format a Word Document based on Check Boxes

Hello everyone,



I want to start out by saying this is my first post, so at the chance that this is in the wrong spot, feel free to move it and inform me of where I should have posted it to begin with. I have also posted this on another forum, and I know some forums want to know everywhere a user has posted so let me know if I should supply that information.

I had a coworker ask me for help the other day with the way we currently edit sales proposals. Essentially we currently have a standard proposal document, and a standard scope document. Each of these documents are multiple pages and have many lines outlining what we plan to do for our customer, the pricing, etc.

The current issue is that each time we want to send these out to a prospective customer, our sales team prints them out, marks them up with what they do and don't need, and sends it to my coworker. She then takes their printed page, and in Word manually removes the lines that are not needed and inputs the values that need changed.

Is there any way that we can create this so that the sales department can go through a sort of check list that allows them to check the boxes that correspond to the line of text that they do or do not want? Then we can create or refresh the form based on that, and have it only include the rows they need, therefore removing the need for us to print it, correct it, and then modify it, and instead just have the sales department click those check boxes doing the whole process right from the start?

I am not sure that a check box system is even the correct way to do this, or if it is possible in general. Please feel free to suggest a better way to do this, or point me in the right direction with the checklist idea.

Also - here is a quote from my coworker to help you get a better idea of what we are looking for.


"Does Word give you some options to create a template where the guys can click (select with a checkmark?) which lines they want to appear, we can “refresh” it, and the stuff we didn’t check would disappear?"


I appreciate any possible help, and if you need any additional info feel free to ask!

Thank you!
Shane
Reply With Quote
  #2  
Old 04-23-2020, 02:55 PM
macropod's Avatar
macropod macropod is offline Auto Create/Format a Word Document based on Check Boxes Windows 7 64bit Auto Create/Format a Word Document based on Check Boxes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,927
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

See, for example:
For content control checkboxes -
https://www.msofficeforums.com/word-...e-answers.html
For formfield checkboxes -
https://www.msofficeforums.com/word/...html#post30792
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-24-2020, 11:44 AM
shanerolle shanerolle is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2019
Novice
Auto Create/Format a Word Document based on Check Boxes
 
Join Date: Apr 2020
Posts: 10
shanerolle is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
See, for example:
For content control checkboxes -
https://www.msofficeforums.com/word-...e-answers.html
For formfield checkboxes -
https://www.msofficeforums.com/word/...html#post30792
Hey macropod! I really appreciate the response, that first link seems like it is doing a little more of what I am looking for and I plan to give that a shot.

I worked through the examples you had on that thread, and I tested it and got it to delete the unchecked boxes and only leave the checked boxes and their rows of text. One question I have is, is there a way that once the macro is finished removing the unchecked rows, can it also remove the remaining check boxes that were originally checked while leaving the rows of text, or is that something that will need to be done manually? I just want to tidy up the document so there are not check boxes remaining once it is finished.

I apologize if this is a dumb question, I tried to read through the macro and figure it out on my own but I am still a bit of an amateur when it comes to creating and coding macros.

I appreciate your help!!
Reply With Quote
  #4  
Old 04-24-2020, 03:43 PM
macropod's Avatar
macropod macropod is offline Auto Create/Format a Word Document based on Check Boxes Windows 7 64bit Auto Create/Format a Word Document based on Check Boxes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,927
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

Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim CCtrl As ContentControl, i As Long
Dim Pwd As String, pState As Variant
With ActiveDocument
  If .ProtectionType <> wdNoProtection Then
    Pwd = InputBox("Please enter the Password", "Password")
    pState = .ProtectionType
    .Unprotect Pwd
  End If
  With .Range
    For i = .ContentControls.Count To 1 Step -1
      With .ContentControls(i)
        If .Type = wdContentControlCheckBox Then
          If .Checked = False Then
            .Range.Rows(1).Delete
          Else
            .Delete
          End If
        End If
      End With
    Next
  End With
  If pState <> wdNoProtection Then .Protect Type:=pState, NoReset:=True, Password:=Pwd
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-28-2020, 09:19 AM
shanerolle shanerolle is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2019
Novice
Auto Create/Format a Word Document based on Check Boxes
 
Join Date: Apr 2020
Posts: 10
shanerolle is on a distinguished road
Default

This helped quite a bit! I think I came up with a bit of a different solution and instead just figured out how to delete the entirety of column 1 instead of the individual check boxes, but I appreciate the help!

I have yet another question (I apologize for so many, but am glad you are helping because I feel like I am learning a lot). So I have attached a sample notebook in order to better explain this one. I have been asked if is possible that I add another checkbox that if check, would delete all of the contents of a section, leave the header, and display "Not applicable".

In the example document, currently they would have to select each checkbox in column 1 to remove a row based on what they do and do not what in the document. However, I was wondering if there was a way that they could select one checkbox in order to remove everything in the section below the header, but leave the header behind. They also want it to display "Not Applicable" if they were to select that checkbox.

Based on the sample document, I was hoping there is a way to select one checkbox in order to delete everything below the "Sample Header" sections, but still display the "Not Applicable" option. Even if there were 2 options, one to delete everything below the header, and one to display not applicable, that would be much better.

The current issue is that there might be 15 different rows underneath the header, and they do not want to have to select 15 different checkboxes if the entire section is not needed, they would rather just select 1-2 checkboxes in order to delete the contents, leave the header, and display not applicable.

Hopefully that helped to explain what I am trying to do, and I apologize if I repeated myself a lot. I also included the code I am currently using in the document, obviously if I need to add second column in order to have this additional option, I would need to delete rows 1 and 2, but that is the code I currently have.

Thank you once again, and I apologize for all of the questions!!
Attached Files
File Type: docm Sample Document for Help.docm (19.1 KB, 11 views)
Reply With Quote
  #6  
Old 04-28-2020, 02:47 PM
macropod's Avatar
macropod macropod is offline Auto Create/Format a Word Document based on Check Boxes Windows 7 64bit Auto Create/Format a Word Document based on Check Boxes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,927
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

And where would the "Not Applicable" appear?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 04-28-2020, 04:13 PM
Guessed's Avatar
Guessed Guessed is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,304
Guessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud of
Default

Are you sure you want to delete content based on the value in the check box? This doesn't allow for the user to change their mind or recover if they made an incorrect selection.
I would recommend you hide content rather than delete it. This gives you a more graceful method to re-instate content if the user changes their mind.

Also, your logic of Checked = Delete seems counter-intuitive. Wouldn't checked mean you want that content and unchecked mean remove it?

To demonstrate how I would approach this, add a tag value on a parent checkbox (eg aaa) and then select the children rows below that parent and add a bookmark using the same tagname. Note that the tag value must be a valid bookmark name.
Then run this macro
Code:
Sub ShowHideSubRows()
  Dim aCC As ContentControl
  For Each aCC In ActiveDocument.Range.ContentControls
    If ActiveDocument.Bookmarks.Exists(aCC.Tag) Then
      ActiveDocument.Bookmarks(aCC.Tag).Range.Font.Hidden = Not aCC.Checked
    End If
  Next aCC
End Sub
If your display options are not showing hidden text then this will allow the toggling of the children rows based on the checkbox value of the parent(s).
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #8  
Old 04-28-2020, 05:59 PM
macropod's Avatar
macropod macropod is offline Auto Create/Format a Word Document based on Check Boxes Windows 7 64bit Auto Create/Format a Word Document based on Check Boxes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,927
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 Guessed View Post
Are you sure you want to delete content based on the value in the check box? This doesn't allow for the user to change their mind or recover if they made an incorrect selection.
Given that the process is run only after all the boxes have been checked/unchecked as appropriate, rather than as they're checked/unchecked, there should be little change of mind/incorrect selection risk.

Hiding content isn't especially reliable, as whether content that's formatted as hidden remains visible - or even prints - relies on how the user has Word configured.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 04-28-2020, 09:29 PM
Guessed's Avatar
Guessed Guessed is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,304
Guessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud of
Default

Paul, I agree that hiding content also requires option settings but IMO it is far more useful and easy enough to include in the macro or a startup macro. I would be recommending moving the macro to run automatically on exiting the CC to allow the following functionality that the OP asked for.
Quote:
Originally Posted by shanerolle View Post
In the example document, currently they would have to select each checkbox in column 1 to remove a row based on what they do and do not what in the document. However, I was wondering if there was a way that they could select one checkbox in order to remove everything in the section below the header, but leave the header behind. They also want it to display "Not Applicable" if they were to select that checkbox.
Leaving the macro to run only when the form is complete makes that request pointless.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #10  
Old 04-28-2020, 09:54 PM
macropod's Avatar
macropod macropod is offline Auto Create/Format a Word Document based on Check Boxes Windows 7 64bit Auto Create/Format a Word Document based on Check Boxes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,927
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

On the whole, though, the approach is analogous to employing a userform with a 'submit' button.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 04-29-2020, 07:11 AM
shanerolle shanerolle is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2019
Novice
Auto Create/Format a Word Document based on Check Boxes
 
Join Date: Apr 2020
Posts: 10
shanerolle is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
And where would the "Not Applicable" appear?
The "Not Applicable" in this scenario would just appear below the header, so once the rows are deleted in the section they select, the "Not Applicable" would need to appear below the header title. For Example:

Header
Text 1
Text 2

would become

Header
Not Applicable

Hopefully this helps a little, and if you have any further questions feel free to let me know!
Reply With Quote
  #12  
Old 04-29-2020, 07:22 AM
shanerolle shanerolle is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2019
Novice
Auto Create/Format a Word Document based on Check Boxes
 
Join Date: Apr 2020
Posts: 10
shanerolle is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Are you sure you want to delete content based on the value in the check box? This doesn't allow for the user to change their mind or recover if they made an incorrect selection.
I would recommend you hide content rather than delete it. This gives you a more graceful method to re-instate content if the user changes their mind.

Also, your logic of Checked = Delete seems counter-intuitive. Wouldn't checked mean you want that content and unchecked mean remove it?

To demonstrate how I would approach this, add a tag value on a parent checkbox (eg aaa) and then select the children rows below that parent and add a bookmark using the same tagname. Note that the tag value must be a valid bookmark name.
Then run this macro
Code:
Sub ShowHideSubRows()
  Dim aCC As ContentControl
  For Each aCC In ActiveDocument.Range.ContentControls
    If ActiveDocument.Bookmarks.Exists(aCC.Tag) Then
      ActiveDocument.Bookmarks(aCC.Tag).Range.Font.Hidden = Not aCC.Checked
    End If
  Next aCC
End Sub
If your display options are not showing hidden text then this will allow the toggling of the children rows based on the checkbox value of the parent(s).

When I first was thinking of solutions, I assumed deleting the content was the best way to handle the solution as this will be for a cover and scope sales document, so I did not want the possibility of unwanted information being left behind. I have already informed them that they should save a copy prior to running the macro, just to be sure that they can make any changes if they make a mistake. However, I would not be opposed to trying this if it will do the same thing (remove those rows from being visible/printed, as well as removing the checkboxes in the first column once finished, as we do not want to be able to see them on the final document).

In regards to the Check = Deleted being counter-intuitive, it really depends on the specific situation. When I first had a meeting with my coworkers to create this, I was told there are times where they only need to delete a handful of rows, meaning it would make more sense to select the rows they want to delete, and other times where they only want to keep 20% of the document, which would mean a lot of selections in a 16 page document. This "select to delete whole section" question was kind of a solution they had for that, as they often have sections that don't apply to the sales agreement they are creating, and that is where most of the stuff they would need to delete lies. This should in theory help them, but I have also considered creating a second macro that works the opposite way (so Check = Keep) in order to help them have to make less selections based on the specific scenario they have.

I am open to all kinds of suggestions, as I am still very new to this. I feel like I am learning a lot as I find time to work on this and work through the code and how it all works, but I definitely would be willing to try the "hide" option rather than deleting the rows.
Reply With Quote
  #13  
Old 04-29-2020, 03:11 PM
macropod's Avatar
macropod macropod is offline Auto Create/Format a Word Document based on Check Boxes Windows 7 64bit Auto Create/Format a Word Document based on Check Boxes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,927
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

See attached.
Attached Files
File Type: docm Sample Document.docm (20.9 KB, 10 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 04-29-2020, 06:51 PM
Guessed's Avatar
Guessed Guessed is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,304
Guessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud of
Default

Hiding content is a good solution if you want to have flexibility to revisit selections but not so good if the documents are going out to clients in Word format as you have no control over their Word options.

Looking back over your workflow, I'm thinking I would do this with a summary page at the top of the document and use linked content controls to allow your sales staff to enter the customer-specific info in a single location and then run a macro to remove the unwanted sections and blow away the summary page to leave you with a complete doc customised to that customer.

Summary Info
Customer Name: Click or tap here to enter text.
Business Name: Click or tap here to enter text.
Date of Meeting: Click or tap to enter a date.
Sections Required
☒ Introduction
☒ Section 1
☒ Data Subset 1
☒ Data Subset 2
☒ Data Subset 3
☐ Section 2
☐ Data Subset 1
☐ Data Subset 2
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #15  
Old 05-01-2020, 06:25 AM
shanerolle shanerolle is offline Auto Create/Format a Word Document based on Check Boxes Windows 10 Auto Create/Format a Word Document based on Check Boxes Office 2019
Novice
Auto Create/Format a Word Document based on Check Boxes
 
Join Date: Apr 2020
Posts: 10
shanerolle is on a distinguished road
Default

Thank you both for the replies and advice! I have a few other things to be working on so it may be a few days before I can get to this, but once I get a chance to test it out and get some feed back from my coworkers I will let you know if I need any more assistance! From looking initially these both seem like good solutions so I will have to see what my coworkers think and go from there.

Again - I appreciate you both helping me out and giving me these tips, its helping a lot!

Cheers,
Shane
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-populate Text Field When I Click Check Boxes LobaBlanca Word VBA 2 03-14-2019 08:10 PM
Print documents based on boxes checked in word document eshiffman Word VBA 8 04-05-2018 06:26 AM
Need to create document that will auto insert text based on parameters parisfranco Word 13 07-25-2017 03:21 PM
Word document with check boxes JohnW Word 3 12-01-2016 07:43 AM
Table - Check Boxes - Create Select All lajohn1963 Word Tables 2 09-25-2010 11:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:43 AM.


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