Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Understanding this code snippett

I have 'found' these lines:

If Len(Dir(Application.Path & "\" & "abc.exe")) = 0 _
Or Len(Dir(Application.Path & "\" & "xyz.dll")) _
= 0 Then
MsgBox " very long message "
Exit Sub
End If
Load UserForm1
UserForm1.Show
End Sub

What exactly is the If statement trying to determine,
please?

Regards.


  #2   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Understanding this code snippett

Len(string) give you the length (number of characters) in the given text
string. Since your string is a path to a file (actually the return of the
Dir function checking that path), if the path is not good, Len returns 0.
In effect, it seems to be checking whether you have a valid file path.

You can get more (and better!) info by going into the VBE Help and looking
at both Dir and Len.

Ed

"Stuart" wrote in message
...
I have 'found' these lines:

If Len(Dir(Application.Path & "\" & "abc.exe")) = 0 _
Or Len(Dir(Application.Path & "\" & "xyz.dll")) _
= 0 Then
MsgBox " very long message "
Exit Sub
End If
Load UserForm1
UserForm1.Show
End Sub

What exactly is the If statement trying to determine,
please?

Regards.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Understanding this code snippett

if abc.exe or xyz.dll are missing from the application.path directory.

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
I have 'found' these lines:

If Len(Dir(Application.Path & "\" & "abc.exe")) = 0 _
Or Len(Dir(Application.Path & "\" & "xyz.dll")) _
= 0 Then
MsgBox " very long message "
Exit Sub
End If
Load UserForm1
UserForm1.Show
End Sub

What exactly is the If statement trying to determine,
please?

Regards.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Understanding this code snippett

Thanks to you both.......looking for the file was my guess.
I assume that Application.Path MUST exist and be valid
since it must represent the host application (ie Excel or,
say Office) under which the sub is running.

Regards.

"Tom Ogilvy" wrote in message
...
if abc.exe or xyz.dll are missing from the application.path directory.

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
I have 'found' these lines:

If Len(Dir(Application.Path & "\" & "abc.exe")) = 0 _
Or Len(Dir(Application.Path & "\" & "xyz.dll")) _
= 0 Then
MsgBox " very long message "
Exit Sub
End If
Load UserForm1
UserForm1.Show
End Sub

What exactly is the If statement trying to determine,
please?

Regards.






  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Understanding this code snippett

Stuart,

Actually is stopping the execution of the code if either of the two files
"abc.exe" or "xyz.dll" are not present in the application directory path.

Brian

"Stuart" wrote in message
...
Thanks to you both.......looking for the file was my guess.
I assume that Application.Path MUST exist and be valid
since it must represent the host application (ie Excel or,
say Office) under which the sub is running.

Regards.

"Tom Ogilvy" wrote in message
...
if abc.exe or xyz.dll are missing from the application.path directory.

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
I have 'found' these lines:

If Len(Dir(Application.Path & "\" & "abc.exe")) = 0 _
Or Len(Dir(Application.Path & "\" & "xyz.dll")) _
= 0 Then
MsgBox " very long message "
Exit Sub
End If
Load UserForm1
UserForm1.Show
End Sub

What exactly is the If statement trying to determine,
please?

Regards.










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Understanding this code snippett

As long as we are splitting hairs,
Actually, it puts up a "long message" and then it is exiting the subroutine
that contains that code if either of the files are not existent. This
prevents the userform from being shown. However, if the code is being
called from another subroutine or function, the calling code continues to
execute.

--
Regards,
Tom Ogilvy

wrote in message
...
Stuart,

Actually is stopping the execution of the code if either of the two files
"abc.exe" or "xyz.dll" are not present in the application directory path.

Brian

"Stuart" wrote in message
...
Thanks to you both.......looking for the file was my guess.
I assume that Application.Path MUST exist and be valid
since it must represent the host application (ie Excel or,
say Office) under which the sub is running.

Regards.

"Tom Ogilvy" wrote in message
...
if abc.exe or xyz.dll are missing from the application.path directory.

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
I have 'found' these lines:

If Len(Dir(Application.Path & "\" & "abc.exe")) = 0 _
Or Len(Dir(Application.Path & "\" & "xyz.dll")) _
= 0 Then
MsgBox " very long message "
Exit Sub
End If
Load UserForm1
UserForm1.Show
End Sub

What exactly is the If statement trying to determine,
please?

Regards.










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
understanding of a formula sabi New Users to Excel 5 March 25th 09 08:43 AM
Understanding a formula Jordan Excel Worksheet Functions 1 May 27th 05 05:42 AM
Understanding this formula Sal Excel Worksheet Functions 4 March 26th 05 06:32 PM
Understanding declarations Greg[_16_] Excel Programming 1 January 26th 05 09:35 PM
Help understanding the following VBA code...... Frank[_13_] Excel Programming 1 July 11th 03 05:21 PM


All times are GMT +1. The time now is 04:46 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"