Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Regarding the lstrlen

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
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.




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



All times are GMT +1. The time now is 02:40 AM.

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"