Results 1 to 5 of 5
  1. #1
    shank is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    188

    Pause macro so CMD can run

    MS Access 2007 / Win 7
    I need to pause a macro until an external command processes. I'm assuming teh macro will then continue when the command finishes. I found the below function on the microsoft site. I get error: Run-time error 53 File Not Found: Kernel and when I opt to debug this line is highlighted: While (GetModuleUsage(hMod)). I know nothing about VB. I googled on that error and not finding anything that helps.

    I'm calling the function as RunCode: WaitShell("C:\SSCC Label App\FSSCC.exe")

    How do I get this running? Or, if necessary, is there another function available that will stop a macro long enough for a command window to run then continue when it closes?

    Option Explicit
    Declare Function GetModuleUsage% Lib "Kernel" (ByVal hModule%)
    Function WaitShell(AppName As String)
    Dim hMod As Integer
    hMod = Shell(AppName, 1)
    If (Abs(hMod) > 32) Then


    While (GetModuleUsage(hMod))
    DoEvents
    Wend
    Else
    MsgBox "Unable to start " & AppName
    End If
    End Function

    thanks!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Do you have the link to that MS webpage?

    What is the external command and how is it initiated?

    You reference 'macro' but you show VBA code. Macros and VBA are different things in Access.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    shank is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    188
    Link: https://support.microsoft.com/kb/96844/EN-US
    Command: C:\SSCC Label App\FSSCC.exe
    I'm calling the function as RunCode: WaitShell("C:\SSCC Label App\FSSCC.exe")

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That code was written for VB, not Access VBA. Sometimes code is adaptable. However, I get the same error message.


    I tried Bing: VBA error kernel not found

    I tried changing the code to Kernel32 but that also errored. http://computer-programming-forum.co...e8a978826a.htm

    Virtually all returns concerned VB. Seems to have something to do with a missing dll (library) file. The one time I tried to download and install a library failed. Damn user permissions on Windows 7 home laptop.

    Maybe this will help, all I can give: http://pcsupport.about.com/od/findby...sing-error.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Pause / Wait / Countdown / Timer
    By DevGreg in forum Programming
    Replies: 2
    Last Post: 07-19-2022, 06:30 AM
  2. Replies: 2
    Last Post: 05-05-2012, 02:34 AM
  3. Help with a basic record pause or lock?
    By valkster in forum Programming
    Replies: 0
    Last Post: 03-12-2012, 06:14 AM
  4. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  5. Pause state?
    By Zermoth in forum Programming
    Replies: 1
    Last Post: 12-15-2008, 05:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums