Re: How to pass Excel cell value to VB app variable?

From: Duane Bozarth (dp_bozarth_at_swko.dot.net)
Date: 05/04/04


Date: Mon, 03 May 2004 20:13:29 -0500

Ed wrote:
>
> Bob and Duane: Thanks for all your help, but I'm just not getting it. I
> set a variable strFPath, my file name, and the StrCell, then in VBA tried
> Shell strFPath & "filename.exe" & strCell in just about every possible
> combination of parentheses and double quotes I could think of, and I
> couldn't make it work. Without the strCell, I could get the VB app to
> launch using the parentheses and quotes as below, but no other way. But I
> couldn't get VBA to accept the extra variable. ...snip...

You don't need another variable, what you're trying to do is to build a
single string variable that contains the <entire> command you want to
pass to Shell and use that variable as the argument to Shell.

To debug, build the command string and test print it or look at it in
the IDE until you get it right. Of course, building the string
hardcoded once and getting that to work and then replace the hardcoded
variable value with the cell variable and getting that to reproduce the
same string as the hardcoded version is another incremental step on the
way.

It <will> work if you get the command string built correctly and it will
be much easier to see you have it right (or what's wrong) if you simply
print out the string until you do get it...

If all else fails, post the actual/exact code you're using to build the
command string and somebody here will spot the problem pretty quickly,
no doubt...



Relevant Pages

  • Re: how to get a wav file track length
    ... String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long ... Dim sBuffer As String ... Dim sFileName As String ... used to separate parameters in the MCI command string. ...
    (microsoft.public.vb.general.discussion)
  • Re: Herfried K. Wagner - HELP!
    ... Where did you find the command string ... Private Sub StartRecording() ... mciSimpleSendString("open new type waveaudio alias capture") ...
    (microsoft.public.dotnet.languages.vb)
  • Re: how to get a wav file track length
    ... String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long ... Dim sBuffer As String ... Dim sFileName As String ... used to separate parameters in the MCI command string. ...
    (microsoft.public.vb.general.discussion)
  • Re: A general question about SQL statement
    ... SQL Server caches commands and precompiles them. ... If the command string does ... into the command string, it will change virtually every time, defeating this ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Ping via VBA
    ... and about how to build the command string for the shell. ... Dim a As String ...
    (microsoft.public.excel.programming)