ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling VB from Excel (https://www.excelbanter.com/excel-programming/313082-calling-vbulletin-excel.html)

Ingvar[_2_]

Calling VB from Excel
 
I would like to call a VB module (exe or dll) from Execl
passing the workbook. Cannot figure out how the passing
of the parameter to the exe-module is done. How to code
the VB module accepting the parameter. The VBA-call I
assume is of standard format but how do I get on the exe-
module

Patrick Molloy[_4_]

Calling VB from Excel
 
I assume that you're talking VB6

Read up on command line variables.
In the Exe create an Excel Application object & then you can grab the name
from the passed parameter and open the workbook from the excel object as
normal

from HELP...
Command Function
Returns the argument portion of the command line used to launch Visual Basic
or an executable program developed with Visual Basic.

Public Function Command() As StringRemarks
For applications developed with Visual Basic and compiled to an .exe file,
the Command function returns any arguments that appear after the name of the
application on the command line, as in this example:

MyApp cmdlineargsExample
This example uses the Command function to return the command-line arguments
in an object containing an array.

Function GetCommandLineArgs() As String()
' Declare variables.
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
Return args
End Function
--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"Ingvar" wrote in message
...
I would like to call a VB module (exe or dll) from Execl
passing the workbook. Cannot figure out how the passing
of the parameter to the exe-module is done. How to code
the VB module accepting the parameter. The VBA-call I
assume is of standard format but how do I get on the exe-
module





All times are GMT +1. The time now is 07:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com