Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent: Make styles in tv-script visible by userform

Status
Not open for further replies.

Madeleinenorway

Technical User
Jun 23, 2011
10
NO
[ponytails2]Hi there,

Is there an easy way in vba (word 2010) to detect the used styles in a document and add them as check boxes on a userform, where I can hide/show the styles by toggle check box status? And automatically add another check box, named "All visible" that shows/hide all? (Except from two pre-defined styles). And - if all the styles are present - the "All visible" check box turns on? And vice versa?
The reason I ask, is that I am a writer/producer - and when going into production I write notes that aren´t interesting for the whole crew.

I kind of achieved this through an endless, stupid and not bug-free code. (Sometimes I have to check the boxes all over again, even if I have pressed the "All visible"-checkbox)

I think there might be a "each/next"-statement that could do the trick - but I am a newbee. Are there someone out there who could help me write a more efficient code that:
1 ) scans the used styles in the document
2 ) pass them to a userform (whith names )
3) when checkbox is pressed - the dependent style is toggles its visible/not visible status?

The styles I uses now are:
TOC
Heading
Sequence
Synopsis
Sceneheading (numbered) (Should always be visible)
Action
Technichians
Scenography
Administration
Character/Dialogue (which is actually two different styles - but they have to show up at the same time)

Maybe with the ability to change styles easy - and fire the same code?
Thank you so much in advance.

Best,
Madeleine :)


Embedded: Testdocument. If you call the macro "Synlige" (Visible) my UserForm will show up.

A little snippet of code from my UserForm ("Visalle" means "Show all")

Code:
Private Sub Admin_Change()
If Admin.Value = False Then
ActiveDocument.Styles("Admin").Font.Hidden = True
ElseIf Admin.Value = True Then
ActiveDocument.Styles("Admin").Font.Hidden = False
End If
selvtest
End Sub

 

Private Sub selvtest()
Dim ctl As Control
Dim j As Long
Dim msg As String
For Each ctl In Me.Controls
If TypeOf ctl Is MSForms.CheckBox Then
If Me.Controls(ctl.Name).Value = True Then
j = j + 1
End If
End If
Next
If j <> 6 Then
Me.Visalle.Value = False
Else

If Me.Visalle.Value = True Then
Me.Visalle.Value = False

Else
Me.Visalle.Value = True
End If
End If
End Sub
 



Ask any question at any time.

mint started it off with the key property. The rest is just following the bouncing ball, with regard to Object usage.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi again, Skip. Good morning (almost morning here in Norway). I am back from work and trying to do the coding :). Is Could I bother you with some questions?
a) I have allready written the whole script with the proper formatting. But - when I list every style in use - for some reason the code list like 100s of styles. Is there any easy code for deleting the styles in the document/template that I don not use?
b) Is there a way to parse the styles in use to userform check buttons which turns the font visibility for each style in use on and off?

I know - not easy to answer in a flash. But if you have the time - I would be grateful. Othervise you helped me a lot all ready.

:)
M
 


Since these question will require a VBA code solution, please continue this post in your thread in forum707.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi Skip,
Is it possible to move the whole thread to the forum you mention?
Best,
M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top