troubleshooting Question

Running shell command from Access

Avatar of jdhackett
jdhackettFlag for Ireland asked on
Microsoft AccessShell ScriptingSystem Programming
3 Comments1 Solution629 ViewsLast Modified:
I'm trying to zip some items using Shell.
These are the two commands
    1) pkzipc.exe -add C:\temp\ c:\temp\test.doc
    2) pkzipc -add -passphrase=@c:\temp\secret.txt -cryptalgorithm=aes c:\temp\ c:\temp\test.doc

So I've tried this code, that I saw elsewhere:
Dim strProgramName As String
    Dim strArgument As String

    strProgramName = "pkzipc.exe"
    strArgument = "-add c:\temp\ c:\temp\test.doc"

    Call Shell("""" & strProgramName & """ """ & strArgument & """", vbNormalFocus)

But it doesn't work. Not only that, but the command window closes too quickly, so I can't see why it failed.
So two questions:
a) What is the correct syntax for the Shell command to run both of the pkzip commands above
b) How do I keep the command window open so that I can see the results?


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros