Results 1 to 8 of 8

Thread: how to detect if MSexcel is running???

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2001
    Posts
    5

    how to detect if MSexcel is running???

    Hello, how can I detect from VB that MS Excel is running???

    Thank's


    (

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    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
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2001
    Posts
    5

    Talking

    Thank you!!!!

  4. #4
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    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
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  5. #5
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306
    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.

    If things were easy, users might be programmers.

  6. #6
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    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:

    Code:
    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
    How they came up with "OpusApp" for Word, I'll never know...
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

  7. #7
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306
    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 !!!
    If things were easy, users might be programmers.

  8. #8
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    My pleasure.

    FWIW, I think I might have got those names by searching MSDN for "FindWindow". It'd be worth a try, anyway.
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width