Command Line Syntax for RunApp

shuff

Registered User.
Local time
Today, 10:12
Joined
Oct 13, 2000
Messages
61
Gosh, it's always the simple stuff that seems to trip me up!!!

I am writing a macro that needs to start up Snapfile viewer, then based on the login credentials of the user, open a specific .snp file. The file to be opened is determined by a text field in the credentials table that names the snapfile document for that user. Each user will need to open a snapfile, but the names of those files will each be unique.

So I open a hidden form that has a field showing the name of the snapfile to be opened. The macro's RunApp command line argument looks like this:

"C:\program files\snapshot viewer\snapview.exe " & forms!frmSnpFileName!snap

What is supposed to happen is that snapfile viewer starts, then loads in the file name found in the [snap] field on the form. Unfortunately, while snapfileviewer does start, the command line is choking on the relative argument for the filename. By way of testing, if I type in the literal filename on the command line argument in the macro, it opens perfectly.

Sooo... the question is, how do I get this command line parameter in my macro to understand a relative file pointer obtained from field text? I think this is a syntax issue - just a matter of getting everything letter-perfect.

Thanks in advance for any assistance!

SLH
 
I had exactly the same problem. I tracked it down to the fact that there were spaces in the stored pathname to the .snp file. This is obviously a bug in the snapview.exe parser.

For various reasons I could not simply remove the spaces so I used filecopy to copy the .snp file to a location which did not contain spaces i.e. c:\TempFiles\ and then used the standard command line to open the snap file. Each time this code runs it overwrites the file TempSnapFile.snp so I don't fill the memory with copies of the original .snp files.


snapfile = "c:\TempFiles\TempSnapFile.snp"
On Error Resume Next
FileCopy Me!FilePathWithSpaces, "c:\A2S\TempSnapFile.snp"
stAppName = "C:\Program Files\Snapshot Viewer\SNAPVIEW.EXE " & snapfile
Call Shell(stAppName, 1)

Hope this is helpful
 

Users who are viewing this thread

Back
Top Bottom