View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Regarding the lstrlen



GetCommandLine is NOT a vba but an API function
Api functions often return variable length strings which are terminated
by a chr(0)

Option Explicit
Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA"
() As String


Private Sub test()
Dim s$
s = GetCommandLine
debug.print len(s) 'returns 54000 on my machine
s = Left(s, InStr(s, vbNullChar))
debug.print s

End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Purushotham" wrote:

Hi,

Iam trying to open Excel sheet through run command..

Like this

Excel.exe c:\data.xls c:\graph.xlt

in the vba,
in auto_open sub, Iam calling the Getcommandline() vba
function to get the string..
I am using the strlen VBA function to get the length of
the string..

But strlen function is not returning the complete length
of the string..

Please suggest me regarding this... what is the problem of
strlen function in Excel2002.