Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Modify Grammar Styles (Word 2k-OfcXP)

    I've tried to create a macro to go into Tools | Options |Spelling and Grammar | Settings to change the following:

    Comma required before last item = Yes
    Punctuation required with quotes = Inside
    Spaces required between sentences = 1

    When I try to record the macro the code in the VBE gives me one commented line:

    wdWordDialogToolsOptionsSpellingandGrammar

    and does not record changing the settings.

    Does anybody know what code I can use to do this?

    Thanks for any suggestions.

    Nancy Maze <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: Modify Grammar Styles (Word 2k-OfcXP)

    Nancy,

    If you look up the Word/VBA Help topic "Built-in Dialog Argument Lists" and scroll down to the listing for 'wdDialogToolsOptionsSpellingAndGrammar', you'll see a listing of the properties which you can access programatically.

    It doesn't look though, like the ones you cited are available in this list; unfortunately not all of the elements of Word's dialog boxes are accessible via code.

    Gary

  4. #3
    New Lounger
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modify Grammar Styles (Word 2k-OfcXP)

    Thanks Gary, I looked it up as you suggested. You're right. None of the options applies to the items I need to change. Thanks for the response. <img src=/S/bwaaah.gif border=0 alt=bwaaah width=123 height=15>

  5. #4
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Wellington, New Zealand
    Posts
    143
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modify Grammar Styles (Word 2k-OfcXP)

    Could you perhaps use SendKeys in conjunction with the ToolsGramSettings command?

  6. #5
    New Lounger
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modify Grammar Styles (Word 2k-OfcXP)

    Could you please give me an example of a code line for that? I'm still a beginner with VBA. I read the books and go into the helps and MSDN, but I'm not a programmer so I still struggle. Thanks. <img src=/S/newbrain.gif border=0 alt=newbrain width=21 height=22>

  7. #6
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Wellington, New Zealand
    Posts
    143
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Modify Grammar Styles (Word 2k-OfcXP)

    Nancy

    The following code works for me:

    SendKeys "{TAB}{RIGHT} {DOWN}{ENTER}{RIGHT} {DOWN}{ENTER}{RIGHT} {DOWN}{ENTER 2}"
    Dialogs(wdDialogToolsGrammarSettings).Show

    The SendKeys entries are the same as what you'd enter manually, using the keyboard, once the dialog box was open. The spaces equate to the spacebar, and {DOWN} and {RIGHT} equate to the arrow keys. My understanding is that these are stored in the keyboard buffer (memory) until required - in this case by the dialog box that's activated. It's a clunky way of doing things, but if it works ...

    I'm using Word XP, and my "Comma required before last item" options are "always", "never" and "don't check". If "always" isn't equivalent to Word 2000's "Yes", you'll need to change the first {DOWN} - perhaps to {DOWN 2} or {DOWN 3}, which is the same as pressing the down arrow 2 or 3 times.

    You may need to ensure that there's a document open before using this code, and it does flash the dialog box on the screen. As far as I'm aware there's no easy way to stop that flashing.

    Good luck.

Posting Permissions

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