Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    Style propigation (wxppr mso2003)

    Hi

    Can any onyone tell me what is wrong with the following?
    Sub stylecopy()
    '
    ' stylecopy Macro
    ' Macro recorded 10/11/2006 by Phil Carter
    '
    With ActiveDocument
    .UpdateStylesOnOpen = True
    .AttachedTemplate = "Normal"
    End With
    Application.OrganizerCopy Source:="Normal.dot", _
    Destination:=ActiveDocument.Name, _
    Name:="CABIS Level 1", _
    Object:=wdOrganizerObjectStyles
    Application.OrganizerCopy Source:="Normal.dot", _
    Destination:=ActiveDocument.Name, _
    Name:="CABIS Level 2", _
    Object:=wdOrganizerObjectStyles
    Application.OrganizerCopy Source:="Normal.dot", _
    Destination:=ActiveDocument.Name, _
    Name:="CABIS Normal", _
    Object:=wdOrganizerObjectStyles
    End Sub

    I recorded it and altered it based on code posted by HansV in post 581498. (Couldn't figure out how to concatenate the statements)

    Also, I cannot seem to get the "Auotmatically update document styles" button to stick. I check the box in Normal.dot, save it, but when I reopen the Normal.dot the box is unchecked
    cheers

    Phil Carter

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Style propigation (wxppr mso2003)

    What happens when you try to run this code? Does it give an error message? If so then what message, at which line?

    Can you single step the code and see what it is doing?

    StuartR

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    Re: Style propigation (wxppr mso2003)

    Stuart thanks for getting back

    When I run the code I get an error message that highlights the first copy (CABIS 1).
    cheers

    Phil Carter

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

    Re: Style propagation (wxppr mso2003)

    Try this one instead - if you are updating the styles from Normal anyway then there is no point in individually doing just three of the styles. The update on open seems to stick for me, perhaps due to the .dot being added, perhaps the reversing of the order or perhaps removing the organiser lines.
    <pre>Sub stylecopy()
    With ActiveDocument
    .AttachedTemplate = "Normal.dot"
    .UpdateStylesOnOpen = True
    .UpdateStyles
    End With
    End Sub</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

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

    Re: Style propigation (wxppr mso2003)

    You can't attach a template to a template so you can't set the Automatically Update Document Styles on a template itself. Is that what you are trying to do?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Style propigation (wxppr mso2003)

    Phil,

    Please tell us the actual text of the error message.

    StuartR

  7. #7
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    Re: Style propagation (wxppr mso2003)

    Andrew hi

    Thanks for that. I combined this with some code that Hans posted in #607582 to strip all non built in styles before using your code to copy all styles from the Normal.dot and it works just great.

    In your next post you stated that I cannot apply a template to a template. Yes I was trying to have the template make Automatically Update Document Styles checked, but this is of no consequence now.

    Thanks again
    cheers

    Phil Carter

  8. #8
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts

    Re: Style propigation (wxppr mso2003)

    Stuart

    Thanks for getting back. I have overcome the problem with the code that Andrew put forward and some code that Hans posted . See my answer to ?Andrew # 613,525

    FYI the error messge I was getting, as I stated this was at the first copy.
    Attached Images Attached Images
    cheers

    Phil Carter

Posting Permissions

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