Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Style changes - hidden font (Word 2000/2003 etc)

    Hi

    I wonder if you guys can help - I am sure you can.

    I have template and a macro to set/unset hidden font for a particular style. These styles are used in a document in various place - standard paragraph, tables etc.

    The scenario:

    3 style - Normal (FW Only), Normal (OW Only) & Normal (TW Only) - all based on normal of course [img]/forums/images/smilies/smile.gif[/img]
    if a document ouput if FW then set others font to hidden and so on
    So, I select the output type then run a macro set/unset hidden font for a particular style as follows:

    1. Select output type (FW, OW or TW)
    2. Set / unset hidden property of a style as follows:

    Function resetStyle ()
    Select Case GetValueOfCDP(sWT)
    Case iFWType
    With ActiveDocument
    .Styles(sNormalFWOnly).Font.Hidden = False
    .Styles(sNormalTWOnly).Font.Hidden = True
    .Styles(sNormalOWOnly).Font.Hidden = True
    End With
    Case iOWType
    With ActiveDocument
    .Styles(sNormalFWOnly).Font.Hidden = True
    .Styles(sNormalTWOnly).Font.Hidden = True
    .Styles(sNormalOWOnly).Font.Hidden = False
    End With
    Case iTWType
    With ActiveDocument
    .Styles(sNormalFWOnly).Font.Hidden = True
    .Styles(sNormalTWOnly).Font.Hidden = False
    .Styles(sNormalOWOnly).Font.Hidden = True
    End With
    End Select
    End function

    Therefore, the table would contain something like this:

    Option Description (Style)
    FW_Start This is the option for FW ... ( sNorma lFW Only)
    OW_Start This is of Over station blah blah .. (sNormal OW Only)
    TW_Start The TW_Start does the following .... (sNormal TW Only)

    Only one line should be visible when the document is printed. Others must be hidden.

    But these setting SOMETIME(!) do not have any effect at all. The font DOESN'T change to hidden. Any ideas or perhaps is there a better/another/simpler way of achieving the same effect? There is no set pattern as why is sometimes works and other time doesn't.

    Thanks in advance.

    Robie
    Thanks.
    Robie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Style changes - hidden font (Word 2000/2003 etc)

    Could it be caused by manually applied character formatting? Have you checked whether the Hidden setting in the style definition really remains unchanged?

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Style changes - hidden font (Word 2000/2003 etc)

    I don't know what you mean by 'manual' character formatting exactly? When defining entries in the table, I select the whole row and set it to the specific style.

    Then when needed I would run the macro to set/unset the styles. I have run the macro under VBA and it goes though these lines

    If .Styles(sNormalTableOWOnly).Font.Hidden = False Then
    .Styles(sNormalTableOWOnly).Font.Hidden = True
    End If

    but the value still remains 'FALSE' ! don't really understand it?

    Robie
    Thanks.
    Robie

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Style changes - hidden font (Word 2000/2003 etc)

    Can you attach a sample document with the macros? You should remove sensitive information, or replace it with dummy data.

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Style changes - hidden font (Word 2000/2003 etc)

    Are you sure the font attributes are not being applied? It is possible that sometimes you have the option to view or print hidden text set on and at other times it is set off.
    Perhaps you need to post a sample as Hans has requested.

    The following is a suggested rewrite of the code to simplify the logic. You could remove all the If lines if you were to modify the GetValueOfCDP function to return the stylename instead of an integer

    Dim sShowStyle as String, iVal as Integer
    With ActiveDocument
    .Styles(sNormalFWOnly).Font.Hidden = True
    .Styles(sNormalTWOnly).Font.Hidden = True
    .Styles(sNormalOWOnly).Font.Hidden = True
    iVal = GetValueOfCDP(sWT)
    If iVal = iFWType then sShowStyle = sNormalFWOnly
    If iVal = iOWType then sShowStyle = sNormalOWOnly
    If iVal = iTWType then sShowStyle = sNormalTWOnly
    .Styles(sShowStyle).Font.Hidden = False
    End With
    End function
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Style changes - hidden font (Word 2000/2003 etc)

    Hans

    Unfortunately I can't upload anything from work (even if it means delay to the project <img src=/S/sad.gif border=0 alt=sad width=15 height=15> ). I will only be able to do it from home - this will probably be tomorrow now.

    Andrew

    Thanks for the code. It certainly seems simpler compared to mine. I will try this out & let you know if it works. Thanks.

    Robie.
    Thanks.
    Robie

Posting Permissions

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