UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Run An Exe File With VBA, Any Version    
 
   
youngb
post Mar 13 2018, 04:14 AM
Post#1



Posts: 531
Joined: 2-September 03
From: Galway, Ireland


Hi,

I want to use VBA to open the following exe file:
QUOTE
C:\Program Files\TightVNC\tvnviewer.exe


using the following config file:
QUOTE
C:\DB\minipc-gmil-009 Balloon.vnc



Thanks in advance for any suggestions.

Regards
Brian



Go to the top of the page
 
DanielPineault
post Mar 13 2018, 04:46 AM
Post#2


UtterAccess VIP
Posts: 5,951
Joined: 30-June 11



What about using Shell. I believe you can use a command like (see UltraVNC Viewer Commandline Parameters from https://www.uvnc.com/docs/uvnc-viewer.html)

tvnviewer -optionsfile=FILENAME

So, you could try

CODE
Shell  """C:\Program Files\TightVNC\tvnviewer.exe""" & " -optionsfile=" &  """C:\DB\minipc-gmil-009 Balloon.vnc"""

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
youngb
post Mar 13 2018, 05:22 AM
Post#3



Posts: 531
Joined: 2-September 03
From: Galway, Ireland


That works Great,

the part I didn't have the was the :
QUOTE
& " -optionsfile="


Thanks
Brian
Go to the top of the page
 
DanielPineault
post Mar 13 2018, 05:23 AM
Post#4


UtterAccess VIP
Posts: 5,951
Joined: 30-June 11



thumbup.gif

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
youngb
post Mar 14 2018, 09:07 AM
Post#5



Posts: 531
Joined: 2-September 03
From: Galway, Ireland


Hi Daniel,

that works well but is there a way I can get it to work using a string Variable I can't seem to figure out the correct syntax.

I have got it working for

QUOTE
'Shell """C:\Program Files\TightVNC\tvnviewer.exe""" & " -optionsfile=" & """K:\Database System\Mini PC\MINIPC-GMIL-32.vnc"""


but then when I try the following code:

CODE
    Dim OptionFile As String
    
    OptionFile = "K:\Database System\Mini PC\MINIPC-GMIL-32.vnc"

    Shell """C:\Program Files\TightVNC\tvnviewer.exe""" & " -optionsfile=" & """ & OptionFile  & """
    'Or Shell """C:\Program Files\TightVNC\tvnviewer.exe""" & " -optionsfile=" & ""OptionFile""


Thanks

Brian
Go to the top of the page
 
DanielPineault
post Mar 14 2018, 09:41 AM
Post#6


UtterAccess VIP
Posts: 5,951
Joined: 30-June 11



Try

CODE
Shell """C:\Program Files\TightVNC\tvnviewer.exe""" & " -optionsfile=""" & OptionFile  & """




--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
cheekybuddha
post Mar 14 2018, 01:13 PM
Post#7


UtterAccess VIP
Posts: 9,973
Joined: 6-December 03
From: Telegraph Hill


Sometimes it helps to break down all the components:
CODE
  Dim PathToExe As String, OptionFile As String
  Const OPTION_SWITCH As String = "-optionsfile, _
        SP As String = " ", _
        EQ As String = "="

  PathToExe = Chr(34) & "C:\Program Files\TightVNC\tvnviewer.exe" & Chr(34)    ' Surround with double quotes here
  OptionFile = Chr(34) & "K:\Database System\Mini PC\MINIPC-GMIL-32.vnc" & Chr(34)

  Shell PathToExe & SP & OPTION_SWITCH & EQ & OptionFile


(or perhaps not?)

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
youngb
post Mar 21 2018, 10:09 AM
Post#8



Posts: 531
Joined: 2-September 03
From: Galway, Ireland


Hi Guys,

I got that to work using the code:

CODE
    VNCPath = Nz(DLookup("TextValue", "T_CONFIG", "[Config] = """ & "VNCPath" & """"), "K:\Database System\Mini PC RDC\Balloon\")
    OptionFile = VNCPath & Me.MACHINE_NAME & ".vnc"
    Shell """C:\Program Files\TightVNC\tvnviewer.exe""" & " -optionsfile=""" & OptionFile & """"


Thanks for all the help.

Go to the top of the page
 
DanielPineault
post Mar 23 2018, 04:43 PM
Post#9


UtterAccess VIP
Posts: 5,951
Joined: 30-June 11



thumbup.gif

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    20th June 2018 - 09:41 PM