Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleDetermine if the program is running in the IDE or an executable.
KeywordsIDE, executable, run, running
CategoriesTips and Tricks, Software Engineering
 
In an executable, Debug.Print statements are skipped (if they do not invoke functions). This program uses that fact to set the value of the InIDE variable appropriately.
 
Private InIDE As Boolean

Private Sub SetInIDE()
    On Error GoTo DivideError
    Debug.Print 1 / 0
    InIDE = False
    Exit Sub
    
DivideError:
    InIDE = True
End Sub

Private Sub Form_Load()
    SetInIDE
    If InIDE Then
        MsgBox "In the IDE"
    Else
        MsgBox "In an executable"
    End If
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated