Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Writing Styles from VBA (Word 97 SR-2)

    Here's a good one -- how can we access the Writing Styles from VBA? What properties and/or methods address this?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Writing Styles from VBA (Word 97 SR-2)

    In Word 2000... Paste this into a VBA module, then select the property and hit F1 for more information from the online help:

    Languages(1033).WritingStyleList
    ActiveDocument.ActiveWritingStyle(1033)

    Please post any follow-up questions, and whatever solution you develop. It might come in handy some day!

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Writing Styles from VBA (Word 97 SR-2)

    Jefferson,

    These are interesting properties. It seems that these are read-only though, so changing the settings via code may still be unattainable(?)

    Gary

  4. #4
    Star Lounger
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Writing Styles from VBA (Word 97 SR-2)

    Thanks for the info, although I'm mystified as to how to use this. I looked at Languages -- the count was only 171, so where does your index of 1033 come from? Also, how is Languages attached to a document, since it did not require activedocument. as a prefix?

    I looked at .ActiveWritingStyle -- it worked as you said, telling me which writing style is in force. Now I need to modify specific characteristics of the Custom writing style. Have any further ideas?

    Thanks for your help.

    Dale Napier

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Writing Styles from VBA (Word 97 SR-2)

    1033 is the internal code for English(US).
    Use of such a value is very poor programming practice.
    Instead use the built-in constant wdEnglishUS.

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Writing Styles from VBA (Word 97 SR-2)

    The Languages value refers to which language version of Office you have installed - 1033 is the constant which Microsoft has assigned to US English - I doubt that this is anything but a read-only property and therefore isn't going to be much use.

    Same thing (I think) with .ActiveWritingStyle - that's a read-only property, and there doesn't appear to be anything provided in VBA for working with this.

    There are a number of odd bits and pieces of the Word application, for which no programming tools have been provided in the Word/VBA object model.

    Gary

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Writing Styles from VBA (Word 97 SR-2)

    Dale, sorry, no idea. Can you modify the writing style interactively in Word? If so, does the macro recorder supply any code when you do?

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Writing Styles from VBA (Word 97 SR-2)

    Yes, Howard, that constant is listed in the help screens to which I referred, and to which I was providing a quick and dirty shortcut. <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

Posting Permissions

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