Hello,
It's my first time on this forum so sorry for any mistakes that i might make while posting.
Additionally, I'm pretty new to VBA so most of my coding is from patching together parts of projects i found in other posts and trying to make them work for me.
I'm making an interactive word form that will show different templates of the forms my organization is currently using depending which checkbox(Activex Checkbox) is checked or option chosen from a drop down menu (Activex ComboBox).
The templates are inserted in tables that VBA hides when the checkbox is not active.
I have this piece of code that does it for the combobox:
Private Sub ComboBox1_Change()
Select Case ComboBox1
Case "Schools LEA REF"
With ActiveDocument.Tables(4).Rows(1)
If .HeightRule = wdRowHeightExactly Then
.HeightRule = wdRowHeightAuto
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
Else
.HeightRule = wdRowHeightExactly
.Height = ".5"
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
End If
End With
Case "Foster Carers"
With ActiveDocument.Tables(5).Rows(1)
If .HeightRule = wdRowHeightExactly Then
.HeightRule = wdRowHeightAuto
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
Else
.HeightRule = wdRowHeightExactly
.Height = ".5"
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
End If
End With
lbl_Exit:
Case Else
End Select
End Sub
There's more options there but they're just a repetition of the same process.
My question is, is it possible, to make that code hide the form that is showing after it was selected if another option was selected from combobox (so essentialy to only show the form that has been selected), at the moment if i choose an option and then choose a different one it moves the previously selected form lower and pops the new one above it.
I can attach my current doument here if necessary.
If this is not possible, another question would be if it's possible to make Ativex Checkbox invisible in word, I've checked the properties and it doesn't have the visibe property to change there (despite having it in excel), is there a trick to it in word?
I would greatly appreciate any help. Thank you.