Hello, how can I detect from VB that MS Excel is running???
Thank's
:D :D
:((
Printable View
Hello, how can I detect from VB that MS Excel is running???
Thank's
:D :D
:((
well an easy way:
On error goto ErrH
AppActivate "Excel",1
me.setfocus
exit sub
ErrH:
Msgbox "Excel Is not running"
im sure there is a much more accurate way...this was just a simple one
Thank you!!!!
;)
Alternatively...
Code:Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
If FindWindow("XLMAIN", 0) > 0 Then
MsgBox "Excel is Running!"
End If
Hey InvisibleDuncan, that is a very cool way.
Where did you find the "XLMAIN" name? Do you know the names of word, access, powerpoint, ...?
By the way, I really like the seven steps for developing. They made me laugh loudly.
:cool: :) :cool: :) :cool: :) :cool: :) :cool: :) :cool: :)
I can't remember where I found the class names, but I saved them in Excel so I wouldn't have to do it again. The ones I've got are:
How they came up with "OpusApp" for Word, I'll never know... :DCode:Application Class Name
CALC.EXE SciCalc
CALENDAR.EXE CalWndMain
CARDFILE.EXE Cardfile
CLIPBOARD.EXE Clipboard
CLOCK.EXE Clock
CONTROL.EXE CtlPanelClass
EXCEL.EXE XLMain
EXPLORER.EXE ExploreWClass
MS-DOS.EXE Session
NOTEPAD.EXE Notepad
PBRUSH.EXE pbParent
PBRUSH.EXE MSPaintApp
PIFEDIT.EXE Pif
PRINTMAN.EXE PrintManager
PROGMAN.EXE Progman
RECORDER.EXE Recorder
REVERSI.EXE Reversi
SETUP.EXE #32770
SOL.EXE Solitaire
TERMINAL.EXE Terminal
WINFILE.EXE WFS_Frame
WINHELP.EXE MW_WINHELP
WINVER.EXE #32770
WINWORD.EXE OpusApp
WORDPAD.EXE WordPadClass
WRITE.EXE MSWRITE_MENU
Thank you very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very much !!!
My pleasure. :D
FWIW, I think I might have got those names by searching MSDN for "FindWindow". It'd be worth a try, anyway.