locked
Explanation of Line of VBA Code RRS feed

  • Question

  • Can anyone explain to me in beginners terms what the following line of code does?

     

    retVal = Shell(strAccPath & strLocalDestinationFile & " /WRKGRP w:\FINAL\ProjTrack\WIF\System1.mdw" & "/cmd ValidStart", vbMaximizedFocus)

     

    where strAccPath = "c:\Program Files\microsoft office\office12\msaccess.exe and strLocalDestinationFile = "c:\ProjTrack\UserFrontEnd\Projects.accdb"

     

    The code is in a startup module in an MS Access 2007 database.  Any help would be greatly appreciated.  Thanks.

    Friday, August 19, 2011 8:22 PM

Answers

  • truetide wrote:
    > Can anyone explain to me in beginners terms what the following line
    > of code does?
    >
    > retVal = Shell(strAccPath & strLocalDestinationFile... vbMaximizedFocus)
     
    Open the accdb, maximized and with focus.
     
    > & " /WRKGRP w:\FINAL\ProjTrack\WIF\System1.mdw"
     
    Use this workgroup file.
     
    > & "/cmd ValidStart",
     
    Pass the string "ValidStart" to the accdb.
    In the accdb a macro or code can use the Command() function
    to read what has been passed via the command line switch /cmd.
     --
    cu
    Karl
    *********
    Access-FAQ (German/Italian): http://www.donkarl.com
     
     
    • Proposed as answer by danishani Tuesday, March 6, 2012 1:38 AM
    • Marked as answer by truetide Tuesday, March 6, 2012 12:25 PM
    Friday, August 19, 2011 10:08 PM