Parameters to a program in a ppt show?

  • Thread starter Thread starter Erik Kullberg
  • Start date Start date
E

Erik Kullberg

I have a VisualBasic program that I want to run when I press a button in a
PowerPoint picture. That program needs a parameter input - the name of an
input file. I do not want to waste lecture time with manual file search. Is
there a way to send a string (or any variable), defined at design of the
show, from ppt to the called program?
I have full access to the VB program code (I have written it myself).
/ Erik

==============================================
Erik Kullberg
Address: Enhagsvägen 2
S-589 43 Linköping
Sweden
Tel home: +46 (0)13 21 94 35
Tel mobile: +46 733 56 19 56
E-mail: (e-mail address removed)
My place: N 58 deg, 23.115' - E 015 deg, 42.137'
My place too: http://www.shell.linux.se/kueng/
 
Steve,
That looks reasonable, thank you!
But where and how do I use "Command$" in my VB program?
Can you give me a few words about it - I cannot find it in the help file...
/ Erik
 
But where and how do I use "Command$" in my VB program?
Can you give me a few words about it - I cannot find it in the help
file...

Ah, the New Improved Help. Pah.
;-)

Command Function Example
This example uses the Command function to get the command line arguments in
a function that returns them in a Variant containing an array.

Function GetCommandLine(Optional MaxArgs)
'Declare variables.
Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs
'See if MaxArgs was provided.
If IsMissing(MaxArgs) Then MaxArgs = 10
'Make array of the correct size.
ReDim ArgArray(MaxArgs)
NumArgs = 0: InArg = False
'Get command line arguments.
CmdLine = Command()
CmdLnLen = Len(CmdLine)
'Go thru command line one character
'at a time.
For I = 1 To CmdLnLen
C = Mid(CmdLine, I, 1)
'Test for space or tab.
If (C <> " " And C <> vbTab) Then
'Neither space nor tab.
'Test if already in argument.
If Not InArg Then
'New argument begins.
'Test for too many arguments.
If NumArgs = MaxArgs Then Exit For
NumArgs = NumArgs + 1
InArg = True
End If
'Concatenate character to current argument.
ArgArray(NumArgs) = ArgArray(NumArgs) & C
Else
'Found a space or tab.
'Set InArg flag to False.
InArg = False
End If
Next I
'Resize array just enough to hold arguments.
ReDim Preserve ArgArray(NumArgs)
'Return Array in Function name.
GetCommandLine = ArgArray()
End Function

This is an example from VB6 help. Don't rely on it to work well with
filenames; it's looking for spaces and tabs, so a command line like:

MyProgram c:\my files\my programs\my program.exe

will turn into several different commandline arguements (c:\my, files\my,
programs\my, and program.exe) when you want it to be one.
 
Back
Top