Consulting

Results 1 to 14 of 14

Thread: Advice: Using Sendkeys to delete Styles

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Expert brettdj's Avatar
    Joined
    May 2004
    Location
    Melbourne
    Posts
    649
    Location

    Advice: Using Sendkeys to delete Styles

    I wrote a simple loop to delete all styles besides "Normal" from a users workbook. But certain rogue styles caused the loop to crash although the user reported that he could delete them manually.

    So I thought simple, I'll use Sendkeys....

    The weird thing is that I can't get the delete to work once I raise the style dialog box.

    The first style in the dropdown box is "Normal" and all the other styles are above so I use {UP 2} to grab the next style. Then it doesn't work as expected..............


    Application.SendKeys ("%OS{UP 2}%M")
    'correctly opens up modify for the desired style as does
    Application.SendKeys ("%OS{UP 2}{TAB}~")

    BUT


    Application.SendKeys ("%OS{UP 2}%D")
    'does not delete the selected style, nor does
    Application.SendKeys ("%OS{UP 2}{TAB 2}~")
    ' This one opens up merge, even though merge is 3 manual tabs not 2
    Any ideas?

    Cheers

    Dave
    Last edited by brettdj; 06-14-2004 at 09:03 PM.

Posting Permissions

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