Hey thanks for the help
I have been making great progress on my little project. I hit a wall today
In my template, I have a user form that has textboxes, comboboxes and checkboxes that turn on and off various layers for a wiring diagram. The user can close the userform and edit no problem.
When the userform is reinitialized it will read the elements on the page created when the form was open and autopopulate the fields in the user form. This way the form starts off as blank but if you are going back and forth to create more wiring diagrams you dont lose all your data. I am able to repopulate the comboboxes and text boxes with the code below but can not get a checkbox to check automatically based on layer:
Code for toggling checkbox that is not working
If
Application.ActiveWindow.Page.Layers.Item(254).CellsC(visLayerVisible).FormulaU = "1" Then
TVSpeaker.Value = True
Else
TVSpeaker.Value = False
End If
Here is an example of re-populating a textbox and combobox that is working
TextBox Example:
HospitalName.Value = Application.ActiveWindow.Page.Shapes.ItemFromID(1343).Characters
ComboBox Example":
If Application.ActiveWindow.Page.Layers.Item(255).CellsC(visLayerVisible).FormulaU = "1" Then
KBSelect.Value = "Current"
ElseIf Application.ActiveWindow.Page.Layers.Item(256).CellsC(visLayerVisible).FormulaU = "1" Then
KBSelect.Value = "Legacy"
Else
CableSelect.Value = " "
End If
Hi migseye,
Assuming that your checkbox' name is TVSpeaker, the code should be like below;
If
Application.ActiveWindow.Page.Layers.Item(254).CellsC(visLayerVisible).FormulaU = "1" Then
TVSpeaker = True
Else
TVSpeaker = False
End If
I was able to solve this by moving my statement above the section where I define my drop downs. For some reason, having this below would trigger the value being shifted even though no command was given.