Re: How to start MS Access 2003 app from vb.net app

From: Brendan Reynolds (anonymous)
Date: 03/03/05


Date: Thu, 3 Mar 2005 15:05:55 -0000

Thanks for that Brian. This is just my opinion based on a few cursory tests,
so I could be wrong, but the way it looks to me so far is that the help
topic is just poorly phrased. As far as I can see, Command/Command$ is
always available in VBA, but most Office applications (I checked Word and
Excel help, I haven't checked PowerPoint) don't support the /cmd start-up
switch, so when using these applications, while the Command function is
available, there's nothing for it to return. I expect (though I have not
tested this) that Command$() will always return an empty string in Office
applications other than Access. I have not tested whether Command() (without
the '$') returns an empty string or a Null value.

-- 
Brendan Reynolds (MVP)
"Brian" <bcap@IHATESPAMclara.co.uk> wrote in message 
news:1109852123.26104.0@ersa.uk.clara.net...
>
> "Brendan Reynolds" <anonymous at discussions dot microsoft dot com> wrote 
> in
> message news:uTZcd44HFHA.2564@tk2msftngp13.phx.gbl...
>> I believe that what follows /x on the command line has to be the name of 
>> a
>> macro rather than a function. I can get a macro named Main to run using
> the
>> following syntax ...
>>
>> Dim ClientPath As String = "C:\Program Files\Microsoft
>> Office\OFFICE11\MSACCESS.EXE " & _
>>     """" & "C:\DSDATA\Northwind.mdb" & """" & " /x Main"
>>
>> Note that /x Main is outside the doubled quotes.
>>
>> So we can run a maco, and you can use the RunCode action in a macro to
>> execute a VBA procedure from the macro. However, I'm not aware of any
> method
>> to pass a parameter to the macro. (I don't make much use of macros, so if
>> anyone else knows of a way, I hope they won't hesitate to say so.)
>>
>> While I have never used it, while checking the help file for the syntax
> for
>> command line options, I noticed the /cmd option. So I tried modifying the
>> VB.NET code as follows ...
>>
>>         Dim ClientPath As String = "C:\Program Files\Microsoft
>> Office\OFFICE11\MSACCESS.EXE " & _
>>             """" & "C:\DSDATA\Northwind.mdb" & """" & " /cmd 42"
>>
>> ... then using RunCode in an AutoExec macro in the Access MDB to call the
>> following function ...
>>
>> Public Function MyFunction()
>>
>>     If Command$() = "42" Then
>>         MsgBox "42"
>>     Else
>>         MsgBox "Not 42"
>>     End If
>>
>> End Function
>>
>> In my tests, using Access 2003, this works. If the .NET code passes the
>> value "42", the message box displays the text "42". If the .NET code
> passes
>> any other value, the message box displays the text "Not 42".
>>
>> However, according to the help file, it shouldn't work! The help file 
>> says
>> that the Visual Basic Command$()  function is not available in Office
>> applications. I'm not sure, therefore, wether it is safe to recommend the
>> use of this function.
>>
>> I'll ask around, and see if I can find any further information on whether
>> this function is supported in Access or not - or perhaps someone else
>> reading this may be able to comment on that?
>>
>
> Hi Brendan,
>
> The Command() function is supported in Access, I've used it many times, 
> it's
> certainly described in A2002 help.
>
> Brian
>
> 


Relevant Pages

  • Re: How to start MS Access 2003 app from vb.net app
    ... Well now we know why you are a "MVP"! ... macro (I haven called a macro for more than 12 years and don't want to start ... for the shell command. ... > While I have never used it, while checking the help file for the syntax ...
    (microsoft.public.access.modulesdaovba)
  • Re: How to start MS Access 2003 app from vb.net app
    ... I can get a macro named Main to run using the ... command line options, ... However, according to the help file, it shouldn't work! ... > "Brendan Reynolds" wrote ...
    (microsoft.public.access.modulesdaovba)
  • Re: How to start MS Access 2003 app from vb.net app
    ... I can get a macro named Main to run using ... > So we can run a maco, and you can use the RunCode action in a macro to ... > While I have never used it, while checking the help file for the syntax ... > command line options, ...
    (microsoft.public.access.modulesdaovba)
  • Buttons
    ... Okay, I tried following the instructions in the Help file, but to no ... What I'm trying to do is assign a macro to a command button ... from Sheet 1 to Sheet 15. ...
    (microsoft.public.excel.programming)
  • Re: command button and macros
    ... Assign Macro and select the macro. ... "Brian" wrote in message ... > After placing a command button on a worksheet, how do I go about assigning ... > macro to that command button. ...
    (microsoft.public.excel.worksheet.functions)

Loading