Consulting

Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 41 to 60 of 71

Thread: Macro to highlight if certain Word table cells are blank

  1. #41
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Ahh, good question. You'll need to adjust the code. However, stick with your existing logical construct:

    1. You check the .Tag property
    2. *most* of the controls you do a single thing (white background if not default text, otherwise rose background)-- this is the Case Else statement
    3. All the other controls, you do something specific. You may also wish to do what you do for all of the other controls. If that's the case (no pun intended), it might help to to use a boolean flag inside of your select case, and then perform your "standard" action outside of the select case, based on the boolean flag. Or it might be just as easy to repeat the code. This is kind of a style question.

    [vba]
    Sub DoStuff
    Dim bDoStandard As Boolean

    Select Case Something
    Case 1
    'do some stuff, but not the standard
    Case 2
    'do some special stuff, and do the standard
    bDoStandard = True
    Case Else
    bDoStandard = True
    End Select

    'what's the standard?
    If bDoStandard Then
    'Do you standard stuff
    End If
    End Sub
    [/vba] It's really a judgement call on whether the "Standard stuff" is worth being separated out into a subroutine, semi-modularized as I did above, or simply take the code you'd have in that If bDoStandard...End If logic chunk, and just copy paste whereever you need it in the routine.

    See what you come up with, and then ask for comments! First order of business is always: get it working the way you want.

    Style can come later.

  2. #42
    VBAX Regular
    Joined
    Dec 2006
    Posts
    71
    Location
    This may be a dumb question but why do I need to adjust the code if it is working properly?

    I assumed that if the code was working properly the probelm wasn't with the code, it was with my understanding of how it was working.

    Had I really understood the Case command earlier this question would have popped up then.

    We have the the longname and shortname cases earlier in the code that check for character length only. How do they get properly formatted to a white background if changed from the placeholder? I don't understand how you get code outside of that particular case to affect the case.

    I'm missing something.

  3. #43
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Is it? It doesn't seem to work properly in all cases (to me). But I don't fully understand what it is that you're trying to do, and I also don't fully understand ContentControls

    Remember, this code triggers when you *leave* each of the content controls in your document, so you need to deal with all cases of the .Tag property.

    If I leave voteauth with Jerry Lewis selected, voteauthin turns white.
    But if I enter voteauthin, click the delete key (so that I don't see the "Click to enter authority as required" text), and then leave voteauthin, it goes back to Rose (although typing something leaves it as white).

    So I know not all bases are covered at that moment. There is more going on which maybe Greg can explain with his deeper understanding of content controls.

    But you would probably be well-served to deal with voteauthin whenever you leave it, just to make sure... although I suspect some of what you perceive as "working" may be something to do with default settings on content controls.

    I really haven't wrapped my mind around the particulars of content controls yet, so I suspect I'm missing an essential concept in trying to explain exactly what is going on here.

  4. #44
    VBAX Regular
    Joined
    Dec 2006
    Posts
    71
    Location
    What I am trying to do overall is detect if a content control has had text entered (for text content controls) or had an option selected (for a drop down). If no text has been entered or no drop down selected then I want to highlight the content control.

    The code works.

    My only exception pertains to the voteauth and voteauthin controls. If voteauth is "Jerry Lewis" then I don't care if voteauthin is blank. It should not be highlighted.

    That is working. What I need to happen is if voteauth is changed off of "Jerry Lewis" (to any other drop down list entry) and voteauthin is blank, then highlight voteauthin as something now needs to be entered there.

    I also still don't understand if we have a case that only looks for character length (the longname and shortname cases) then how does typing something in and then exiting that control have the background changed to white since it appears to me that all we asked the code to do for that case is look for character length. Ultimately this is the behavior I want so I'm not too unhappy but I would like to understand how we are getting other code to run for that case.

    Frosty, using your example above the longname and shortname cases fall into your:
    [VBA]Case 2
    'do some special stuff, and do the standard
    bDoStandard = True
    [/VBA]


    However, the only code we provide is for the special stuff. We never tell it to do the standard stuff yet it does anyway.
    Last edited by g8r777; 08-03-2011 at 01:19 PM.

  5. #45
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location

    Trying to get caught up.

    First question. Why did I go to the trouble of revising your OnExit event code if you aren't going to use it?

    If I understand the issue correctly if you select Jerry Lewis from the voteauth dropdown and then exit you don't want the voteauthin CC flagged with rose shading. Correct?

    If so then:

    1. Use the CCExit event to detect the CC tagge "voteauth" using and additional case statement.
    2. Evaluate its value
    3. Get the CC you want to change.
    4. Change it.

    [VBA]Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Dim oRng As Word.Range
    If ActiveDocument.ProtectionType <> wdNoProtection Then
    ActiveDocument.Unprotect Password:="12345"
    End If
    Select Case CC.Tag
    Case "longname1", "longname2", "longname3", "shortname"
    If Validate(CC) Then
    CC.Range.Select
    End If
    'Or
    Cancel = Validate(CC)
    Case "voteauth"
    If CC.Range.Text = "Jerry Lewis" Then
    ActiveDocument.SelectContentControlsByTag("voteauthin").Item(1).Range.Shadi ng.BackgroundPatternColor = wdColorWhite
    Else
    ActiveDocument.SelectContentControlsByTag("voteauthin").Item(1).Range.Shadi ng.BackgroundPatternColor = wdColorRose
    End If
    End Select
    If CC.ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    Else
    Select Case CC.Tag
    Case "Date1", "Date2", "Date3"
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    Case Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End Select
    End If
    If ActiveDocument.ProtectionType = wdNoProtection Then
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="12345"
    End If
    End Sub
    Function Validate(oCC_Tested As ContentControl) As Boolean
    If (Not oCC_Tested.ShowingPlaceholderText) And Len(oCC_Tested.Range.Text) > 48 Then
    MsgBox "Limit 48 characters per line."
    Validate = True
    Else
    Validate = False
    End If
    End Function[/VBA]

    CCs and their ranges are a bit quirky and I don't fully understand the under the hood mechanics. It seems that VBA cannot determine what color wdcolor automatic should be if placeholder text is displayed. You can see this for yourself by adding a single CC to a new document and running this code:

    [VBA]Sub ScratchMacro()
    Dim oCC As ContentControl
    Dim i As Long
    Set oCC = ActiveDocument.ContentControls(1)
    oCC.Range.Text = "some text"
    oCC.Range.Shading.BackgroundPatternColor = wdColorBrown
    oCC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    'Showing placeholder text
    oCC.Range.Text = ""
    oCC.Range.Shading.BackgroundPatternColor = wdColorBrown
    i = oCC.Range.Shading.BackgroundPatternColor
    oCC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    'Did it change?
    If oCC.Range.Shading.BackgroundPatternColor = i Then
    'No.
    oCC.Range.Shading.BackgroundPatternColor = wdColorWhite
    End If
    End Sub
    [/VBA]





    Quote Originally Posted by g8r777
    This may be a dumb question but why do I need to adjust the code if it is working properly?

    I assumed that if the code was working properly the probelm wasn't with the code, it was with my understanding of how it was working.

    Had I really understood the Case command earlier this question would have popped up then.

    We have the the longname and shortname cases earlier in the code that check for character length only. How do they get properly formatted to a white background if changed from the placeholder? I don't understand how you get code outside of that particular case to affect the case.

    I'm missing something.
    Greg

    Visit my website: http://gregmaxey.com

  6. #46
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Well, you peaked my interest and I should learn about content controls at some point anyway. And I still don't totally understand. And since I am actually trying to get my own work done, I will leave you with the code that really works.

    The ThisDocument code is more robust in that it deals with all the scenarios (basically, any time you're going to create an associate between controls, you will almost always need to create the reciprocal association as well, or you will rapidly find yourself with a couple of logic flaws in your code).

    The ThisDocument code module:
    [vba]
    Option Explicit
    Private Sub Document_New()
    UnprotectActiveDocument
    FlagEmptyCCs
    ProtectActiveDocument
    End Sub
    Private Sub Document_Open()
    ' UnprotectActiveDocument
    ' FlagEmptyCCs
    ' ProtectActiveDocument
    ' ThisDocument.Saved = True
    End Sub
    Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Dim oRng As Word.Range
    Dim oOtherCC As ContentControl
    Dim bIgnoreControl As Boolean
    'make it accessible to be changed
    UnprotectActiveDocument

    'check which control we're dealing with
    Select Case CC.Tag

    Case "longname1", "longname2", "longname3"
    'can't ahve more than 48 characters on a line
    If (Not CC.ShowingPlaceholderText) And Len(CC.Range.Text) > 48 Then
    MsgBox "Limit 48 characters per line.", vbInformation
    Cancel = True
    End If

    Case "shortname"
    'we require less than 20 characters
    If (Not CC.ShowingPlaceholderText) And Len(CC.Range.Text) > 20 Then
    MsgBox "Short Name must be 20 characters or less.", vbInformation
    CC.Range.Select
    End If

    'we need to adjust another control, based on this control's settings
    Case "voteauth"

    'so find the other control
    Set oOtherCC = fGetContentControl("voteauthin")

    'make sure a control was returned
    If Not oOtherCC Is Nothing Then
    'if our current control is Jerry Lewis, we don't care what's in our other control
    If CC.Range.Text = "Jerry Lewis" Then
    oOtherCC.Range.Shading.BackgroundPatternColor = wdColorWhite
    bIgnoreControl = True
    End If
    End If

    'We need to adjust this control based on another control's settings
    Case "voteauthin"
    'so find the other control
    Set oOtherCC = fGetContentControl("voteauth")

    'make sure a control was returned
    If Not oOtherCC Is Nothing Then
    'if our current control is Jerry Lewis, we don't care what's in our other control
    If oOtherCC.Range.Text = "Jerry Lewis" Then
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    bIgnoreControl = True
    End If
    End If

    'if not dealt with above, it's in the "do standard" category
    Case Else
    'nothing to see here
    End Select

    'Unless we should ignore it, do our standard formatting
    If bIgnoreControl = False Then
    'leave the color normal if we've changed from the placeholder text
    If CC.ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    'otherwise indicate with a special color
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End If
    End If

    'reprotect it
    ProtectActiveDocument
    End Sub
    'A function allowing you to pass in the tag property, and return the content control
    Public Function fGetContentControl(sTag As String) As ContentControl
    Dim oCC As ContentControl

    'cycle through all our content controls
    For Each oCC In ActiveDocument.ContentControls
    If UCase(oCC.Tag) = UCase(sTag) Then
    'found it! Set our return value and exit the function
    Set fGetContentControl = oCC
    Exit For
    End If
    Next
    End Function
    [/vba] The Main code module replacement:
    NOTE: it seems to me (and I defer to Greg), that, at least for the code project you uploaded, you don't need to cycle through all tables, all cells in each table, and then through any content controls in a cell... you can just as easily (and more efficiently) go through the ActiveDocument.ContentControls collection.

    Of course, if you are dealing with multiple document types, and some content controls exist outside of a table and you want to leave those alone, You would need to keep the old system. BUT-- your "Clear Fields" routine goes through all of the active document content controls, while your FlagEmptyCCs doesn't... so that is a flawed approach to cycle through one way in one routine, and another way in another routine... unless it is intentional.
    [vba]
    Option Explicit 'Forces varible declaration
    Public Sub ProtectActiveDocument()
    'now we re-protect
    If ActiveDocument.ProtectionType = wdNoProtection Then
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="12345"
    End If
    End Sub
    Public Sub UnprotectActiveDocument()
    'unprotect the document, if it needs it
    If ActiveDocument.ProtectionType <> wdNoProtection Then
    ActiveDocument.Unprotect Password:="12345"
    End If
    End Sub
    'Clear the fields and flag them as empty
    Sub ClearFields()
    Dim oCC As ContentControl
    Dim oILS As InlineShape

    'clear out all the content controls
    For Each oCC In ActiveDocument.ContentControls
    Select Case oCC.Type
    Case wdContentControlRichText
    oCC.Range.Text = ""
    Case wdContentControlDropdownList
    oCC.DropdownListEntries(1).Select
    End Select
    Next oCC
    For Each oILS In ActiveDocument.InlineShapes
    If oILS.Type = wdInlineShapeOLEControlObject Then
    If TypeOf oILS.OLEFormat.Object Is MSForms.OptionButton Then
    oILS.OLEFormat.Object.Value = False
    End If
    End If
    Next

    FlagEmptyCCs

    End Sub

    'NOTE: this function does not flag any content controls NOT in a table
    Public Sub FlagEmptyCCs()
    Dim oCC As ContentControl
    Dim oCCs As ContentControls

    For Each oCC In ActiveDocument.ContentControls
    Select Case oCC.Tag
    'for the dates, leave them white even if they are empty
    Case "Date1", "Date2", "Date3"
    oCC.Range.Shading.BackgroundPatternColor = wdColorWhite
    Case Else
    If oCC.ShowingPlaceholderText = True Then
    oCC.Range.Shading.BackgroundPatternColor = wdColorRose
    Else
    oCC.Range.Shading.BackgroundPatternColor = wdColorWhite
    End If
    End Select
    Next oCC
    End Sub
    [/vba]

  7. #47
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Darn it... I should have refreshed before posting. Thanks for the info, Greg... good to know the quirks of content controls.

    I defer to Greg's posting, just leaving my rewrite for reference-- take a look at your ClearFields methodology of cycling through your content controls vs your FlagEmptyCCs methodology.

    And, as you can see, you don't need the function I created (fGetContentControl) since that function was already created by Microsoft, and is called SelectContentControlsByTag

  8. #48
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location

    Update

    Reading todays posts closer I noticed that I missed Jason's point about the possibility of a user changing voteauthin after "Jerry Lewis" was selected in voteauth. Little things like that just illustrate how quickly things can get complicated and frustrate when a paying custom says I want "X" and then come back later with gee "X" is great but I really want "Y."

    You have opened up a whole new can of worms (no pun intended).

    A few comments. First while I like and have a fair knowledge of content controls I feel a userform would better suit your needs.
    Secondly, this new requirement brings out the fact that ContentControls were not really intended for use in Protected Forms.

    Once again I have practically rebuilt this form so it will work.

    The first thing I did was remove the code to protect and unprotect the form and put all the CCs in one big RichText control. The RichText control is locked for editing but the controls inside are not. This sort of protects the form.

    Here is the revised code if you don't want to download the doc.

    Your "ThisDocument" module:

    [VBA]Option Explicit
    Private Sub Document_New()
    Call FlagEmptyCCs
    End Sub
    Private Sub Document_Open()
    Call FlagEmptyCCs
    ThisDocument.Saved = True
    End Sub
    Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Dim oRng As Word.Range 'Deleted this as it isn't used. GKM
    Dim oCC_Target As ContentControl 'Added this GKM
    Select Case CC.Tag
    'This is our rich text container holding all of the form CCs. We don't want to do anything with it so get out.
    Case "Collection": Exit Sub
    'These are the four special case CCs that require data validation
    Case "longname1", "longname2", "longname3", "shortname"
    'Do it with a funciton
    If fnc_InInvalidData(CC) Then
    CC.Range.Select
    End If
    'Or
    'Cancel = fnc_InInvalidData(CC)
    'This is a special case CC
    Case "voteauth"
    'This is the CC that you are going to manipulate while processing the special case CC
    'P.S. it would be nice if you used distintive titles and tabs (e.g., Voting Authority)
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("voteauthin").Item(1)
    If CC.Range.Text = "Jerry Lewis" Then
    'You really don't even want the CC to show. To bad there isn't a CC.Visible property.
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = " " 'So it isn't showing placeholder text
    .Shading.BackgroundPatternColor = wdColorAutomatic
    End With
    'To deal with the shmucks.
    .LockContents = True
    End With
    'Move to the next CC of interest
    ActiveDocument.SelectContentControlsByTag("acmtype").Item(1).Range.Select
    Else
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = ""
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If
    End Select
    'Why when leaving "longname1, 2, 3, or short name does the backgroud color change?
    'Because we are now out of the Select Case statement that evaluated them specifically and are now evaluating them
    generally:
    If CC.ShowingPlaceholderText = False Then
    'Deal with "voteauthin"
    If CC.LockContents = True Then
    'Don't try to change it.
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    End If
    Else
    Select Case CC.Tag
    Case "Date1", "Date2", "Date3"
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    Case Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End Select
    End If
    End Sub
    Function fnc_InInvalidData(oCC_Tested As ContentControl) As Boolean
    If (Not oCC_Tested.ShowingPlaceholderText) And Len(oCC_Tested.Range.Text) > 48 Then
    MsgBox "Limit 48 characters per line."
    fnc_InInvalidData = True
    Else
    fnc_InInvalidData = False
    End If
    End Function[/VBA]

    Your standard module:

    [VBA]Option Explicit 'Forces varible declaration
    Dim oCC As ContentControl
    Dim oCCs As ContentControls
    Dim oLE As ContentControlListEntry
    Sub ClearFields()
    Dim oILS As InlineShape
    Set oCCs = ActiveDocument.Range.ContentControls
    Dim i As Long
    For Each oCC In oCCs
    Select Case oCC.Type
    Case wdContentControlRichText
    If Not oCC.Title = "Collection" Then
    If oCC.LockContents = True Then
    oCC.LockContents = False
    End If
    oCC.Range.Text = ""
    End If
    Case wdContentControlDropdownList
    oCC.DropdownListEntries(1).Select
    End Select
    Next oCC
    For Each oILS In ActiveDocument.InlineShapes
    If oILS.Type = wdInlineShapeOLEControlObject Then
    If TypeOf oILS.OLEFormat.Object Is MSForms.OptionButton Then
    oILS.OLEFormat.Object.Value = False
    End If
    End If
    Next
    Call FlagEmptyCCs
    End Sub
    Sub FlagEmptyCCs()
    Dim oTbl As Word.Table
    Dim oCell As Word.Cell
    Dim oCC As ContentControl
    Dim oCCs As ContentControls
    Set oTbl = ActiveDocument.Tables(1)
    'If ActiveDocument.ProtectionType <> wdNoProtection Then
    ' ActiveDocument.Unprotect Password:="12345"
    'End If
    For Each oTbl In ActiveDocument.Tables
    For Each oCell In oTbl.Range.Cells
    If oCell.Range.ContentControls.Count > 0 Then
    For Each oCC In oCell.Range.ContentControls
    If oCC.ShowingPlaceholderText = True Then
    Select Case oCC.Tag
    Case "Date1", "Date2", "Date3"
    oCC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    Case Else
    oCC.Range.Shading.BackgroundPatternColor = wdColorRose
    End Select
    End If
    Next oCC
    End If
    Next oCell
    Next oTbl
    'If ActiveDocument.ProtectionType = wdNoProtection Then
    ' ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="12345"
    'End If
    End Sub

    [/VBA]
    Attached Files Attached Files
    Greg

    Visit my website: http://gregmaxey.com

  9. #49
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location

    CC Education

    Jason,

    The page is probably like the titel (rough) but when you have time you may find something useful here:

    http://gregmaxey.mvps.org/Content_Controls.htm

    I have actually been working with another guy this week on a project that resolves the OnExit issue in Word2007 and provides and OnChange event.

    As for your comments here is this thread, I appreciate all and as usual all are spot on. I think the reason Brian is looping through tables is because he once asked my how to tag all CCs in a table. Later he asked how to tag all CCs in all tables. I never even thought until now that what he really seemed to want is how to flag all CCs.

    Being retired military I don't seem to be a diplomatic as you. I don't think Brian has taken any of it personally. At least his private correspondence does'nt indicate.


    Quote Originally Posted by Frosty
    Darn it... I should have refreshed before posting. Thanks for the info, Greg... good to know the quirks of content controls.

    I defer to Greg's posting, just leaving my rewrite for reference-- take a look at your ClearFields methodology of cycling through your content controls vs your FlagEmptyCCs methodology.

    And, as you can see, you don't need the function I created (fGetContentControl) since that function was already created by Microsoft, and is called SelectContentControlsByTag
    Greg

    Visit my website: http://gregmaxey.com

  10. #50
    VBAX Regular
    Joined
    Dec 2006
    Posts
    71
    Location
    I haven't taken anything personally. I appreciate all the help as I know both of you probably have much better and more interesting things to do than to help me. I also realize that I am a bit of a novice and have a lot to learn.

    I realize my requests and desires changed as the project progressed and that this made everything much more difficult. For that I apologize. This whole stream has given me a much better understanding of how the code works from both of you (more so than anything else I've worked on).

    The further along we got the more questions were generated for me. Both of you so graciously answered them all and for that I am greatful.

    I believe I now have a much better framework going forward and will get much farther along myself before asking questions. And when I do ask questions I feel they will be much more intelligent and thought out.

    The revised document works flawlessly. I may try to add back the password protection as I would not put it past anyone at my company to figure out how to unlock the RichText field and screw something up. If I can't then I will live with it.

    I liked how you read my mind about not wanting the second field to even show if "Jerry Lewis" was suggested. Code that kind of mind reading an you will be a billionaire.

    Thank you,


    Brian
    Last edited by g8r777; 08-03-2011 at 04:13 PM.

  11. #51
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    You aren't the first client (nor will you be the last) to change the essential nature of the project in mid-stream. Grin.

    For whatever help I provided, you're welcome. And honestly, I get a lot out of these conversations too.

    Best thing to take away from these conversations, if at all possible, isn't the solution nearly so much as how you arrived at the solution. Because knowing the answer isn't nearly as useful as knowing how to find the answer, at least in the computer world. There are simply too many "answers" for one person to hold in his/her mind.

    But there aren't really that many different ways of finding out the answer. Just some are shorter than others.

    Good luck going forward!

    - Jason
    p.s. thanks for the link and the comments, Greg!

  12. #52
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    Brian,

    None of it was meant to be abusive and you are a sport for taking the jabs along with the assistance.

    Like the web title in the link I provided Jason, CCs really are like diamonds in the rough. They have so much potential but it seems that MS pushed them out unfinished. The glaring ommission IMHO is the lack of an OnChange event. With that event your "voteauthin" CC could be formatted when "Jerry Lewis" was select and the user would not need to first exit the CC. Other gross ommission is a direct method of determining which dd entry is selected. It would be nice if there was a .Enabled property. The last two are available with basic form fields so I don't understand why MS didn't provide them with CCs.

    If you are interested in the OnChange evnet (in progress) see:

    http://gregmaxey.mvps.org/ContentCon...ange_Event.htm
    Greg

    Visit my website: http://gregmaxey.com

  13. #53
    VBAX Regular
    Joined
    Dec 2006
    Posts
    71
    Location
    So after testing the document in our real environment, I've come up with one last thing that I would like to have happen (there's a shock I know).

    If longname1 has something entered then longname2 and longname3 do not need to be highlighted but they should still be able to have text entered into them. I liked how Greg handled the voteauth/voteauthin solution but this required locking voteauthin which won't work in the new scenario as users should still be able to enter text.

    I have tried various iterations of Greg's code. I have been able to get longname2 and longname3 to turn white when exiting longname1 but as soon as I exit either of them the turn rose again if blank (by design). I haven't been able to come up with the logic for the exception.

    I have noted what I am trying to have happen in the following code. I have also highlighted in red some code (although it doesn't work) the should illustrate what I am trying to have happen.

    If this is too complicated then I will just live with what we have so far.

    The reason for the splitting of the various name controls is beacuse I was messing around with ways to code this exception.

    Also, shortname has a different invalid data requirement than the longnames which I fixed.

    [VBA]Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Dim oRng As Word.Range
    Dim oVoteAuth As Boolean
    Dim oCC_Target As ContentControl
    Dim oOtherCC As ContentControl
    If ActiveDocument.ProtectionType <> wdNoProtection Then
    ActiveDocument.Unprotect Password:="12345"
    End If
    Select Case CC.Tag

    Case "longname1"
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    'CC.Range.Select
    End If

    Case "longname2", "longname3"
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    'CC.Range.Select
    End If

    Case "shortname"
    If fnc_InInvalidShort(CC) Then
    Cancel = True
    'CC.Range.Select
    End If

    Case "voteauth"
    'This is the CC that you are going to manipulate while processing the special case CC
    'P.S. it would be nice if you used distintive titles and tabs (e.g., Voting Authority)
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("voteauthin").Item(1)
    If CC.Range.Text = "Jerry Lewis" Then
    'You really don't even want the CC to show. To bad there isn't a CC.Visible property.
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = " " 'So it isn't showing placeholder text
    .Shading.BackgroundPatternColor = wdColorAutomatic
    End With
    'To deal with the shmucks.
    .LockContents = True
    End With
    'Move to the next CC of interest
    ActiveDocument.SelectContentControlsByTag("acmtype").Item(1).Range.Select
    Else
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = ""
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If
    End Select
    'Why when leaving "longname1, 2, 3, or short name does the backgroud color change?
    'Because we are now out of the Select Case statement that evaluated them specifically and are now evaluating them
    'generally:
    If CC.ShowingPlaceholderText = False Then
    'Deal with "voteauthin"
    If CC.LockContents = True Then
    'Don't try to change it.
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    End If
    Else
    Select Case CC.Tag

    'These cases should never be highlighted
    Case "Date1", "Date2", "Date3"
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic

    'These cases do not need to be highlighted if something has been entered in longname1. They should be able to have content entered in them
    'should someone need more space than longname one so we cannot lock them like we did with voteauthin.
    Case "longname2", "longname 3"
    If CC.ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    Else

    'If longname1 has something entered then do not highight longname2 or longname3 but also do not lock them
    If ActiveDocument.ContentControls("longname1").ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End If
    End If

    Case Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End Select

    End If
    End Sub[/VBA]

  14. #54
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    1. I thought you determined that wdColorAutomatic was no good? So your second select case seems like it won't be doing what you want.

    2. Your red text, I think, needs to use either the custom function I wrote (not really) OR the microsoft function Greg shows... .SelectContentControlsByTag.

    3. This logic structure kind of makes me confused, although I realize this is the template Greg gave you. However, I think it is easier to understand a routine if you only use a particular logic structure a single time (at the same indent level).

    Having two different Select Case CC.Tag structures, one nested inside a If .ShowingPlaceholderText construct makes it rapidly more difficult to understand what's going on as your project gets more complicated (as it is).

    I would suggest adjusting this to go through the Select Case once, and then just deal with each control (and what you want to do with it) as you need. Or starting with the .ShowingPlaceholderText If statement, and nesting the select cases. This may result in some duplicated code. If too much of that duplicated code shows up-- you know it's a good time to modularize and make your own function.

    But I think, honestly, you're just getting lost in a forest of logical constructs

    You've got two "main" logic checks you want to deal with: 1) the .Tag property (for identifying "special" controls from the "normal" controls) and 2) the .ShowingPlaceholderText value.

    I think your routine should be (in the big picture way) structured in such a way as to make one of those two primary.

    Option 1:
    [vba]
    Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Select Case CC.Tag
    Case 1
    If CC.ShowingPlaceholderText Then
    Else
    End If
    Case 2
    If CC.ShowingPlaceholderText Then
    Else
    End If
    Case Else
    If CC.ShowingPlaceholderText Then
    Else
    End If
    End Select
    End Sub
    [/vba] Option 2:
    [vba]
    Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    If CC.ShowingPlaceholderText Then
    Select Case CC.Tag
    Case 1
    Case 2
    Case Else
    End Select
    Else
    Select Case CC.Tag
    Case 1
    Case 2
    Case Else
    End Select
    End If
    End Sub
    [/vba] Having the two structures somewhat mixed and matched is simply causing confusion (in my humble opinion).

  15. #55
    VBAX Regular
    Joined
    Dec 2006
    Posts
    71
    Location
    Frosty,

    I agree with your logical construct argument. Cleaning up the code and making it more logical (which I am sure will also serve to further my understanding) is a project for another day.

    You were correct about using Greg's SelectContentControlsByTag method. I have now been able to get the document to do everything I need it to do. The final code is below.

    I know it is ugly (formatting wise). As a point of convention do you use tabs or spaces to indent different lines?



    [VBA]Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Dim oRng As Word.Range
    Dim oVoteAuth As Boolean
    Dim oCC_Target As ContentControl
    If ActiveDocument.ProtectionType <> wdNoProtection Then
    ActiveDocument.Unprotect Password:="12345"
    End If
    Select Case CC.Tag

    Case "longname1"
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    'CC.Range.Select
    End If

    'remove highlighting from longname2 and longname3 if text entered in longname1
    If CC.ShowingPlaceholderText = False Then
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname2").Item(1)
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorWhite
    End With
    End With

    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname3").Item(1)
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorWhite
    End With
    End With
    End If

    'highlight longname2 and longname3 only if longname1 is cleared AND longname2 and longname3 are cleared
    If CC.ShowingPlaceholderText = True Then
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname2").Item(1)
    If oCC_Target.ShowingPlaceholderText = True Then
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If

    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname3").Item(1)
    If oCC_Target.ShowingPlaceholderText = True Then
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If
    End If

    Case "longname2", "longname3"
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    'CC.Range.Select
    End If

    Case "shortname"
    If fnc_InInvalidShort(CC) Then
    Cancel = True
    'CC.Range.Select
    End If
    Case "voteauth"
    'This is the CC that you are going to manipulate while processing the special case CC
    'P.S. it would be nice if you used distintive titles and tabs (e.g., Voting Authority)
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("voteauthin").Item(1)
    If CC.Range.Text = "Jerry Lewis" Then
    'You really don't even want the CC to show. To bad there isn't a CC.Visible property.
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = " " 'So it isn't showing placeholder text
    .Shading.BackgroundPatternColor = wdColorAutomatic
    End With
    'To deal with the shmucks.
    .LockContents = True
    End With
    'Move to the next CC of interest
    ActiveDocument.SelectContentControlsByTag("acmtype").Item(1).Range.Select
    Else
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = ""
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If
    End Select
    'Why when leaving "longname1, 2, 3, or short name does the backgroud color change?
    'Because we are now out of the Select Case statement that evaluated them specifically and are now evaluating them
    'generally:
    If CC.ShowingPlaceholderText = False Then
    'Deal with "voteauthin"
    If CC.LockContents = True Then
    'Don't try to change it.
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    End If
    Else

    Select Case CC.Tag

    Case "Date1", "Date2", "Date3"
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite

    'keep longname2 and longname3 from rehighlighting if they are blank but longname1 has something entered
    Case "longname2", "longname3"
    If CC.ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    Else
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname1").Item(1)
    If oCC_Target.ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End If
    End If

    Case Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End Select
    End If
    End Sub[/VBA]

  16. #56
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Be wary of the "I'll do it right *later*" argument too much. As with word processing... it always takes a little longer to "do it right" initially. But it pays such dividends later. Remember, you know how this code is supposed to work as good as you are going to right now-- so that is the time to restructure. Not 6 months from now when you have to take the time to re-learn what it was supposed to do. Typically my process is this:

    1. Get something working
    2. Have someone else verify it's working as they want it to
    3. Fix whatever I messed up, give back
    4. Get a "yah, that's basically it"
    <<end proof of concept phase>>
    5. Clean up my code
    6. Deliver the final product.

    If the timeline is such that I need to deliver an intermediary product before #5, I do (which is basically #4). But I'm always trying to make sure the update process is as automated as possible (because there will always be a need to update), and so steps #5 & #6 aren't such a big deal.

    Anyway-- that's just generic advice. Of course delivery is always more important than perfection.

    As for the discussion point on tabs and indenting:
    These are the things I always change, immediately upon doing development on a machine (all in the VBA development environment)
    Inside Tools > Options...
    1. Editor > Auto Syntax Check (checked off, default is checked on) (highlights mistakes in coding in red, rather than popping up a message box to tell me it's wrong)
    2. Editor > Require Variable Declaration (checked on, default is checked off) -- this puts Options Explicit at the top of every new module/class/form
    3. Editor > Tab Width = 2 (default is 4)
    4. Editor Format > Code Colors > Keyword Text (foreground a bright blue, default is a dark blue -- just easier for me to read)

    And then close that dialog and I...
    5. Show all the Debug and Edit toolbars (only Standard is generally showing)
    6. Customize my standard toolbar by adding the Compile Project command at the end of it (it's at the top of the Debug category). This helps remind me to click that compile button all the time, which has saved me more often than I can count.
    7. Play with my windows so that I can easily read my code, still see my project explorer and immediate window, as well as have my Locals Window and Watch window docked close to the immediate window, so I can double-click them quickly to see what's going on in a particular routine (Locals and Watch window are something to explore- they are hugely useful at times)

    Of course, YMMV.

  17. #57
    VBAX Regular
    Joined
    Dec 2006
    Posts
    71
    Location
    Excellent suggestions as always. I now know why all the code you and Greg have sent have had indenting two spaces off from where mine is. I have been tabbing and then deleting two spaces each time to try to get the same indenting as you.

    By "another day" I did mean sooner rather than later. I do need to get this document deployed and it works. I just meant that I could clean it later as it it already working.

  18. #58
    VBAX Regular
    Joined
    Dec 2006
    Posts
    71
    Location
    Frosty,

    So "sooner" was sooner rather than later. I am attempting to code for some more complex conditional formatting (at the request of one of my users now that the document is deployed). It made sense for me to clean up now.

    If you have time (and I know that's asking a lot) please take a look at the code below. I tried to clean up the formatting and tried to come up with one logical construct, in this case Option 1 that you provided.

    I have prioritized Tag over ShowingPlaceholderText. I hope what I did is what you were trying to point out. The code has the same functionality as the old code but appears much cleaner to me.

    [vba]Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Dim oCC_Target As ContentControl

    Select Case CC.Tag

    Case "longname1"
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    'CC.Range.Select
    End If

    If CC.ShowingPlaceholderText = True Then

    CC.Range.Shading.BackgroundPatternColor = wdColorRose

    'highlight longname2 and longname3 only if longname1 is cleared AND longname2 and longname3 are cleared
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname2").Item(1)
    If oCC_Target.ShowingPlaceholderText = True Then
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If

    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname3").Item(1)
    If oCC_Target.ShowingPlaceholderText = True Then
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If
    Else

    CC.Range.Shading.BackgroundPatternColor = wdColorAutomatic
    'remove highlighting from longname2 and longname3 if text entered in longname1
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname2").Item(1)
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorWhite
    End With
    End With

    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname3").Item(1)
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorWhite
    End With
    End With
    End If


    Case "longname2", "longname3"
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    'CC.Range.Select
    End If

    If CC.ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    Else

    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("longname1").Item(1)
    If oCC_Target.ShowingPlaceholderText = False Then
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    End If

    End If

    Case "shortname"
    If fnc_InInvalidShort(CC) Then
    Cancel = True
    'CC.Range.Select
    End If
    Case "voteauth"

    If CC.ShowingPlaceholderText = True Then

    CC.Range.Shading.BackgroundPatternColor = wdColorRose

    Else

    'This is the CC that you are going to manipulate while processing the special case CC
    'P.S. it would be nice if you used distintive titles and tabs (e.g., Voting Authority)
    Set oCC_Target = ActiveDocument.SelectContentControlsByTag("voteauthin").Item(1)
    If CC.Range.Text = "Sole" Then
    'You really don't even want the CC to show. To bad there isn't a CC.Visible property.
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = " " 'So it isn't showing placeholder text
    .Shading.BackgroundPatternColor = wdColorAutomatic
    End With
    'To deal with the shmucks.
    ' .LockContents = True
    End With
    'Move to the next CC of interest
    ActiveDocument.SelectContentControlsByTag("acmtype").Item(1).Range.Select
    Else
    With oCC_Target
    .LockContents = False
    With .Range
    .Text = ""
    .Shading.BackgroundPatternColor = wdColorRose
    End With
    End With
    End If
    End If
    Case "Date1", "Date2", "Date3"
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite

    Case Else
    If CC.ShowingPlaceholderText = True Then
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    End If

    End Select
    End Sub[/vba]

    As a random aside, I disabled the locking of voteauthin as that was no longer needed. If this was locked and a user clicked in it (because it was technically still there but with no text or highlighting) then they would get an error message and would be promted to debug. That whole routine freaks my users out. It was easier to have them be able to click in that cell by accident and have nothing happen. No one will type in there anyway. I agree with Greg that it would nice to have a CC.Visible command of some kind to just make the whole content control disappear.

  19. #59
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    This is getting fairly close to a style issue. Apart from a couple of minor comments, what I've done can be summed up pretty simply:
    I've made it easier to read for *my* brain... but maybe not yours.
    1. I've separated out your "color appropriately" function, which I think you can get some mileage out of, if only to clean up the whole wdColorWhite vs wdColorAutomatic thing, and if you ever decide you don't like Rose and want to go with Aqua... it's all in a single place.
    2. There are two "Frosty Notes" -- read those. I'm not sure you want to wipe out data in voteauthin every time someone chooses something other than "Sole" -- remember, people don't always go linearly, and people make mistakes and click the wrong thing. I think you probably want to test whether or not voteauthin is filled with only " " and then you could wipe it out.
    3. I know it works, but I'm still not sure why -- so I added in the colorappropriately function to the "shortname" case.
    4. If you're using the Cancel (which means-- don't do this OnExit routine), then it means you're going to get another shot at the OnExit, so you can use that as a branch to stop the rest of your processing.
    5. If you are setting .LockContents = False in both logic branches, you can pull it out and set above (or get rid of it entirely, perhaps)
    6. With ... End With. Judicious use of this will make your code more readable. It's a judgement call. However, this is not a good use of it:
    [vba]
    With oCC_Target
    With .Range
    .Shading.BackgroundPatternColor = wdColorWhite
    End With
    End With
    [/vba] This works just as well
    [vba]
    oCC_Target.Range.Shading.BackgroundPatternColor = wdColorWhite
    [/vba] 7. Variable naming is a style issue. I renamed oCC_Target to CC_Associate. It makes slightly more sense to me... I'm dealing with CC primarily, and then occasionally an associated CC.
    8. And I always reserve the right to change my mind. With the creation of the ColorAppropriate subroutine, suddenly the .ShowingPlaceholderText became less of a primary logic branch (since I was mostly using that as an argument for the subroutine), and thus I stuck with always thinking of the CC and the associated CCs (thus the slight change in the "longname" cases, structurally). A moving target, I know. But that's when you know it's really just a style issue, rather than right way vs. wrong way.
    Anyway... here's my slight re-write of what you've done. Again, I think the bulk of this is simply style, rather than substance.
    [vba]
    Private Sub Document_ContentControlOnExit(ByVal CC As ContentControl, Cancel As Boolean)
    Dim CC_Associate As ContentControl

    Select Case CC.Tag

    Case "longname1"
    'if invalid, just cancel and do nothing else
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    'otherwise...
    Else
    'color this control appropriately
    ColorAppropriately CC, CC.ShowingPlaceholderText

    'and deal with associated controls...
    Set CC_Associate = ActiveDocument.SelectContentControlsByTag("longname2").Item(1)
    'if primary is blank, color appropriately
    If CC.ShowingPlaceholderText = True Then
    ColorAppropriately CC_Associate, CC_Associate.ShowingPlaceholderText
    'otherwise, don't color
    Else
    ColorAppropriately CC_Associate, False
    End If

    Set CC_Associate = ActiveDocument.SelectContentControlsByTag("longname3").Item(1)
    'if primary is blank, color appropriately
    If CC.ShowingPlaceholderText = True Then
    ColorAppropriately CC_Associate, CC_Associate.ShowingPlaceholderText
    'otherwise don't color
    Else
    ColorAppropriately CC_Associate, False
    End If
    End If

    Case "longname2", "longname3"
    'if invalid length, don't do anything else
    If fnc_InInvalidLong(CC) Then
    Cancel = True
    Else
    'whether to color is determined by primary control, which is...
    Set CC_Associate = ActiveDocument.SelectContentControlsByTag("longname1").Item(1)
    'if primary showing placeholder, color appropriately,
    If CC_Associate.ShowingPlaceholderText Then
    ColorAppropriately CC, CC.ShowingPlaceholderText
    'otherwise, no color regardless
    Else
    ColorAppropriately CC, False
    End If
    End If
    Case "shortname"
    If fnc_InInvalidShort(CC) Then
    Cancel = True
    Else
    ColorAppropriately CC, CC.ShowingPlaceholderText
    End If

    Case "voteauth"
    'color appropriately
    ColorAppropriately CC, CC.ShowingPlaceholderText

    'deal with the associated control, which is...
    Set CC_Associate = ActiveDocument.SelectContentControlsByTag("voteauthin").Item(1)
    'FROSTY NOTE:*** is this line necessary? You had it in both logic branches
    CC_Associate.LockContents = False
    'special case-- adjust our associated content control to not have placeholder text
    If CC.Range.Text = "Sole" Then
    CC_Associate.Range.Text = " "
    'and move to the next CC
    ActiveDocument.SelectContentControlsByTag("acmtype").Item(1).Range.Select
    Else
    'FROSTY NOTE:*** are you sure you want to do this? Selecting "Sole" will wipe out this data
    'perhaps check CC_Associate.range.text against your "blank value" and reset only then, a la
    'the commented out If/End If
    'If CC_Associate.Range.Text = " " Then
    CC_Associate.Range.Text = ""
    'End If
    End If
    'don't forget to color our associated control
    ColorAppropriately CC_Associate, CC_Associate.ShowingPlaceholderText

    Case "Date1", "Date2", "Date3"
    ColorAppropriately CC, False

    Case Else
    ColorAppropriately CC, CC.ShowingPlaceholderText
    End Select
    End Sub
    'consolidation of the two colors you use
    Private Sub ColorAppropriately(ByVal CC As ContentControl, bColored As Boolean)
    If bColored Then
    CC.Range.Shading.BackgroundPatternColor = wdColorRose
    Else
    CC.Range.Shading.BackgroundPatternColor = wdColorWhite
    End If
    End Sub
    [/vba]

  20. #60
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Oh, and in case it wasn't clear... I think your clean up looks great. A huge improvement (and more functional) than the original code you posted. And that was absolutely in the direction I'd talked about earlier.

    So, apart from the with...end with stuff, and a couple of the "are you sure?" questions, everything is mostly just a matter of style and preference at this point. I just revamped a bit as a bit of a brain exercise with the thought of separating out the "ColorThisContentControlThusly" functionality, and a bit of tweaking.

    EDIT: syntax and typos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •