Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default PASSING PARAMETER FORM DOS script to Excel

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?


I have tried this method but it gave me a kernel32 dll error on some pc.

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))


Can anyone help me with this?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default PASSING PARAMETER FORM DOS script to Excel

Bruce,
You have to use this method to open your Excel file ?

If so :
http://p2p.wrox.com/TopicIndex/22874.htm

but maybe it only works on XL97; could not get it work with XL2002.
If I add a
Debug.Print CmdLine
I get a load of binary and code that appears to come from Adode (I have
Acrobat installed).

but
MsgBox CmdLine
shows
"C:\..DOSPathToOffice..\excel.exe" c:\test.xls

Not sure if DDE is an option, but Automation would be easy.

NickHK

"BruceWyne" wrote in message
...
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?


I have tried this method but it gave me a kernel32 dll error on some pc.

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))


Can anyone help me with this?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default PASSING PARAMETER FORM DOS script to Excel

Hi nick,

The script is exactly the same as what i had written previously.
But problem is that some PC will have a KERNEL32 error prompt
It indicated

ModName: kernel32.dll ModVer:5.1.2600.2180 Offset:00009e45 error


Regards
Bruce




"NickHK" wrote:

Bruce,
You have to use this method to open your Excel file ?

If so :
http://p2p.wrox.com/TopicIndex/22874.htm

but maybe it only works on XL97; could not get it work with XL2002.
If I add a
Debug.Print CmdLine
I get a load of binary and code that appears to come from Adode (I have
Acrobat installed).

but
MsgBox CmdLine
shows
"C:\..DOSPathToOffice..\excel.exe" c:\test.xls

Not sure if DDE is an option, but Automation would be easy.

NickHK

"BruceWyne" wrote in message
...
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?


I have tried this method but it gave me a kernel32 dll error on some pc.

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))


Can anyone help me with this?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default PASSING PARAMETER FORM DOS script to Excel

ERROR MESSAGE Faulting application excel.exe, version 9.0.0.8950, faulting
module kernel32.dll, version 5.1.2600.2180, fault address 0x00009e45

"BruceWyne" wrote:

Hi nick,

The script is exactly the same as what i had written previously.
But problem is that some PC will have a KERNEL32 error prompt
It indicated

ModName: kernel32.dll ModVer:5.1.2600.2180 Offset:00009e45 error


Regards
Bruce




"NickHK" wrote:

Bruce,
You have to use this method to open your Excel file ?

If so :
http://p2p.wrox.com/TopicIndex/22874.htm

but maybe it only works on XL97; could not get it work with XL2002.
If I add a
Debug.Print CmdLine
I get a load of binary and code that appears to come from Adode (I have
Acrobat installed).

but
MsgBox CmdLine
shows
"C:\..DOSPathToOffice..\excel.exe" c:\test.xls

Not sure if DDE is an option, but Automation would be easy.

NickHK

"BruceWyne" wrote in message
...
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?


I have tried this method but it gave me a kernel32 dll error on some pc.

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))


Can anyone help me with this?





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default PASSING PARAMETER FORM DOS script to Excel

As I said, I don't think this will on later versions XL after 97.

Why not use automation instead ?
It would be more straight forward.

Or DDE ?

NickHK

"BruceWyne" wrote in message
...
Hi nick,

The script is exactly the same as what i had written previously.
But problem is that some PC will have a KERNEL32 error prompt
It indicated

ModName: kernel32.dll ModVer:5.1.2600.2180 Offset:00009e45 error


Regards
Bruce




"NickHK" wrote:

Bruce,
You have to use this method to open your Excel file ?

If so :
http://p2p.wrox.com/TopicIndex/22874.htm

but maybe it only works on XL97; could not get it work with XL2002.
If I add a
Debug.Print CmdLine
I get a load of binary and code that appears to come from Adode (I have
Acrobat installed).

but
MsgBox CmdLine
shows
"C:\..DOSPathToOffice..\excel.exe" c:\test.xls

Not sure if DDE is an option, but Automation would be easy.

NickHK

"BruceWyne" wrote in message
...
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?


I have tried this method but it gave me a kernel32 dll error on some

pc.

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))


Can anyone help me with this?







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to a query Dwaine Horton[_3_] Excel Programming 6 April 26th 05 02:24 AM
Using Find method in Excel passing more than 1 parameter Nick Excel Programming 3 November 2nd 04 05:56 PM
?Passing argument/parameter just starting Excel Programming 1 October 23rd 04 04:23 PM
Passing a parameter to Excel keepitcool Excel Programming 3 August 13th 03 03:57 AM
Passing parameter from Excel to stored procedure? hmmm... Excel Programming 1 July 25th 03 02:59 PM


All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"