![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | If statement with a message Hello there, I need help reagarding building a vb script. The script need to check if Word or Excel is opened (winword.exe & excel.exe) If they are open to show a message if not to end. Anyone can help? Thank you very much Amir ![]() |
My System Specs![]() |
| | #2 (permalink) |
| | Re: If statement with a message "???? ????" <@discussions.microsoft.com> wrote in message news:1E733B0A-8032-4B83-BA2B-25CEEB7EC966@xxxxxx Quote: > > Hello there, > > I need help reagarding building a vb script. > > The script need to check if Word or Excel is opened (winword.exe & > excel.exe) > If they are open to show a message if not to end. > > Anyone can help? one is one, just that at least one instance is. Set oWMI = GetObject("winmgmts:\root\cimv2") Set oProc = oWMI.ExecQuery("SELECT * FROM Win32_Process WHERE " _ & "name='WINWORD.EXE' OR name='EXCEL.EXE'") If oProc.Count > 0 Then MsgBox "Either Word or Excel (or Both) are open" End If |
My System Specs![]() |
| | #3 (permalink) |
| | Re: If statement with a message Thank you so much !! You are great ! "James Whitlow" wrote: Quote: > "???? ????" <@discussions.microsoft.com> wrote in message > news:1E733B0A-8032-4B83-BA2B-25CEEB7EC966@xxxxxx Quote: > > > > Hello there, > > > > I need help reagarding building a vb script. > > > > The script need to check if Word or Excel is opened (winword.exe & > > excel.exe) > > If they are open to show a message if not to end. > > > > Anyone can help? > I think the below will do what you are asking. It does not advise which > one is one, just that at least one instance is. > > Set oWMI = GetObject("winmgmts:\root\cimv2") > Set oProc = oWMI.ExecQuery("SELECT * FROM Win32_Process WHERE " _ > & "name='WINWORD.EXE' OR name='EXCEL.EXE'") > If oProc.Count > 0 Then > MsgBox "Either Word or Excel (or Both) are open" > End If > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to pass exceptions message outside the trap statement | PowerShell | |||
| Help with SQL statement | VB Script | |||
| goal Statement | Vista mail | |||
| just a statement | Vista General | |||