+ Reply to Thread
Results 1 to 4 of 4

SendKeys and Application.ScreenUpdating

Hybrid View

  1. #1
    Michael Malinsky
    Guest

    SendKeys and Application.ScreenUpdating

    I have a module in which I'm using SendKeys to change a printer
    property. At the beginning of the module, I have
    Application.ScreenUpdating = False so hide the various dialog boxes
    that open and close during the process. The problem is that the
    ScreenUpdating command looks to be ignored as I can see everything that
    is happening.

    Any help is appreciated.

    TIA,
    Mike.


  2. #2
    RB Smissaert
    Guest

    Re: SendKeys and Application.ScreenUpdating

    What you can do is use API calls to freeze the screen. This freezes the
    screen better, but has the drawback that if something goes wrong you are
    stuck with a frozen screen and have to come out with Ctrl + Alt + Del. Also
    you have to unfreeze the screen before for example a MsgBox.

    Put this in the declarations (top of the module):

    Private Declare Function LockWindowUpdate Lib "USER32" (ByVal hwndLock As
    Long) As Long
    Private Declare Function GetDesktopWindow Lib "USER32" () As Long

    Then put this Sub somewhere in your module:

    Sub WindowUpdating(Enabled As Boolean)

    'Completely Locks the Whole Application Screen Area, including dialogs
    and the mouse.

    Dim Res As Long

    If Enabled Then
    LockWindowUpdate 0 'Unlock screen area
    Else
    Res = LockWindowUpdate(GetDesktopWindow) 'Lock at desktop level
    End If

    End Sub

    Then use it in your code like this:

    WindowUpdating (False) 'to freeze the screen

    or:

    WindowUpdating (True) 'to unfreeze the screen



    RBS





    "Michael Malinsky" <mikemalin@hotmail.com> wrote in message
    news:1111259296.898475.198820@o13g2000cwo.googlegroups.com...
    >I have a module in which I'm using SendKeys to change a printer
    > property. At the beginning of the module, I have
    > Application.ScreenUpdating = False so hide the various dialog boxes
    > that open and close during the process. The problem is that the
    > ScreenUpdating command looks to be ignored as I can see everything that
    > is happening.
    >
    > Any help is appreciated.
    >
    > TIA,
    > Mike.
    >



  3. #3
    Michael Malinsky
    Guest

    Re: SendKeys and Application.ScreenUpdating

    I tried your suggestion, but I can still see the all of the print
    dialogs pop up from the SendKeys commands. If I step through it, the
    desktop freezes, but when I run the module, it doesn't seem to work.

    Any ideas on what I'm missing?

    Thanks,
    Mike.


  4. #4
    Fredrik Wahlgren
    Guest

    Re: SendKeys and Application.ScreenUpdating


    "Michael Malinsky" <mikemalin@hotmail.com> wrote in message
    news:1111259296.898475.198820@o13g2000cwo.googlegroups.com...
    > I have a module in which I'm using SendKeys to change a printer
    > property. At the beginning of the module, I have
    > Application.ScreenUpdating = False so hide the various dialog boxes
    > that open and close during the process. The problem is that the
    > ScreenUpdating command looks to be ignored as I can see everything that
    > is happening.
    >
    > Any help is appreciated.
    >
    > TIA,
    > Mike.
    >


    Application.ScreenUpdating = False will only prevent the cells from showing
    updated values.

    /Fredrik



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1