Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
|
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2011, 01:57 PM
Registered User
 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Red face Urgent: Make styles in tv-script visible by userform

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:
  1. TOC
  2. Heading
  3. Sequence
  4. Synopsis
  5. Sceneheading (numbered) (Should always be visible)
  6. Action
  7. Technichians
  8. Scenography
  9. Administration
  10. 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

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Panel visible with Hyperlink Filespit ASP.NET 3.5 Basics 6 August 10th, 2010 10:36 AM
Hide and make visible scandalous ASP.NET 2.0 Basics 0 May 24th, 2007 08:51 AM
to make checkboxes visible in datagrid C# windows bhavna General .NET 1 March 5th, 2007 10:41 AM
Make visible/invisible stealthdevil Access VBA 6 May 31st, 2006 10:59 AM
How do you make a label visible in a form Brian263 Access 2 March 19th, 2004 03:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.