hi
can anyone help me with this problem
Hi can anyone help me with this problem
I have this dos script to pass down a parameter upon opening the excel
@echo off
start excel "\\136.121.2.1\its helpdesk\ConRisk\RSP Concentration Risk
Calculation.xls" /e/8212305557
Is there any code to capture the parameter "8212305557" on the excel macro
upon opening
here is my code
Option Base 1
Private Declare Function GetCommandLineA Lib "Kernel32" () As String
Dim CmdLine As String 'command-line string
Dim Args As Variant
Dim ArgCount As Integer 'number of parameters
Dim Pos1 As Integer, Pos2 As Integer
Dim sMsg As String
Dim Customercode As String
CmdLine = GetCommandLineA 'get the cmd-line string
CmdLine = Mid(CmdLine, 1, 255)
On Error Resume Next 'for the wksht-function "Search"
Pos1 = InStr(1, CmdLine, "/") + 1
Pos1 = InStr(Pos1, CmdLine, "/") + 1
Args = Split(Mid(CmdLine, Pos1, 255), "/")
For ArgCount = LBound(Args) To UBound(Args)
sMsg = sMsg & Args(ArgCount) & vbNewLine
Next ArgCount
Customercode = CStr(Trim(sMsg))
I have tried this method but it gave me a kernel32 dll error on some pc.
Faulting application excel.exe, version 9.0.0.8950, faulting module kernel32.dll, version 5.1.2600.2180, fault address 0x00009e45
Can anyone help me with this

ERROR RUNNING MARCO
swan_sgp
Hi duck thing,
Thank for your help. The system is an ansi system.
When i chang the code to GetCommandLineW it cannot display anything. It work fine on some PC only that why i find it difficult to resolve this problem.
Regards,
Bruce
Lehmberg
Are you getting this error on a Unicode system GetCommandLineA returns ANSI characters. If you need Unicode, use GetCommandLineW. I'm not sure why else this code would crash -- it works fine on my machine.