Regarding the lstrlen

  • Thread starter Thread starter Purushotham
  • Start date Start date
P

Purushotham

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top