Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
understanding of a formula | New Users to Excel | |||
Understanding a formula | Excel Worksheet Functions | |||
Understanding this formula | Excel Worksheet Functions | |||
Understanding declarations | Excel Programming | |||
Help understanding the following VBA code...... | Excel Programming |