Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel 2007 Macro w/ AppActivate = Run-time error '5': Invalid procedure call or argument

Greetings,

Any clue why we get this in an Excel 2007 macro, see below.

Run-time error '5': Invalid procedure call or argument

when running the macro below. The ping starts & runs fine, it's just we get
the error message?

Per...

Sub X_x()
'
' X_x Macro
'
' Keyboard Shortcut: Ctrl+x
'
Dim ReturnValue
ReturnValue = Shell("c:\windows\system32\ping.exe 4.2.2.2 -t")
AppActivate ReturnValue
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Excel 2007 Macro w/ AppActivate = Run-time error '5': Invalid proc

If you are looking to have the focus on the command window try;

Dim ReturnValue
ReturnValue = Shell("c:\windows\system32\ping.exe 4.2.2.2 -t", vbNormalFocus)

If this post helps click Yes
---------------
Jacob Skaria


"Per Moeller-Olsen" wrote:

Greetings,

Any clue why we get this in an Excel 2007 macro, see below.

Run-time error '5': Invalid procedure call or argument

when running the macro below. The ping starts & runs fine, it's just we get
the error message?

Per...

Sub X_x()
'
' X_x Macro
'
' Keyboard Shortcut: Ctrl+x
'
Dim ReturnValue
ReturnValue = Shell("c:\windows\system32\ping.exe 4.2.2.2 -t")
AppActivate ReturnValue
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel 2007 Macro w/ AppActivate = Run-time error '5': Invalid proc

With these two lines

On Error Resume Next
AppActivate ReturnValue

rather than just this one

AppActivate ReturnValue

no errors displayed any longer & the stuff is running. It's a little hacked
I think?

I tried your suggestion, did not make any difference as far as I could tell.

Per...

"Jacob Skaria" wrote in message
...
If you are looking to have the focus on the command window try;

Dim ReturnValue
ReturnValue = Shell("c:\windows\system32\ping.exe 4.2.2.2 -t",
vbNormalFocus)

If this post helps click Yes
---------------
Jacob Skaria


"Per Moeller-Olsen" wrote:

Greetings,

Any clue why we get this in an Excel 2007 macro, see below.

Run-time error '5': Invalid procedure call or argument

when running the macro below. The ping starts & runs fine, it's just we
get
the error message?

Per...

Sub X_x()
'
' X_x Macro
'
' Keyboard Shortcut: Ctrl+x
'
Dim ReturnValue
ReturnValue = Shell("c:\windows\system32\ping.exe 4.2.2.2 -t")
AppActivate ReturnValue
End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Excel 2007 Macro w/ AppActivate = Run-time error '5': Invalid procedure call or argument

Why not just use

Dim ReturnValue As Long
ReturnValue = Shell("c:\windows\system32\ping.exe -t 4.2.2.2",
vbNormalFocus)


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sat, 25 Apr 2009 15:38:12 -0700, "Per Moeller-Olsen"
wrote:

Greetings,

Any clue why we get this in an Excel 2007 macro, see below.

Run-time error '5': Invalid procedure call or argument

when running the macro below. The ping starts & runs fine, it's just we get
the error message?

Per...

Sub X_x()
'
' X_x Macro
'
' Keyboard Shortcut: Ctrl+x
'
Dim ReturnValue
ReturnValue = Shell("c:\windows\system32\ping.exe 4.2.2.2 -t")
AppActivate ReturnValue
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel 2007 Macro w/ AppActivate = Run-time error '5': Invalid procedure call or argument

So no need for AppActivate ReturnValue? Per...

"Chip Pearson" wrote in message
...
Why not just use

Dim ReturnValue As Long
ReturnValue = Shell("c:\windows\system32\ping.exe -t 4.2.2.2",
vbNormalFocus)


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Sat, 25 Apr 2009 15:38:12 -0700, "Per Moeller-Olsen"
wrote:

Greetings,

Any clue why we get this in an Excel 2007 macro, see below.

Run-time error '5': Invalid procedure call or argument

when running the macro below. The ping starts & runs fine, it's just we
get
the error message?

Per...

Sub X_x()
'
' X_x Macro
'
' Keyboard Shortcut: Ctrl+x
'
Dim ReturnValue
ReturnValue = Shell("c:\windows\system32\ping.exe 4.2.2.2 -t")
AppActivate ReturnValue
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid procedure call or argument for Dir$ (Run-time error '5') ? Alan[_8_] Excel Programming 0 July 21st 08 03:14 PM
Run-time Error '5' - Invalid procedure call or argument Trefor Excel Discussion (Misc queries) 2 December 17th 07 03:32 AM
Invalid Procedure Call or Argument - Run-time error '5' Andrew Excel Programming 0 November 20th 07 09:03 PM
Run Time Error 5 - Invalid Procedure Call or Argument Q John[_110_] Excel Programming 3 September 26th 05 09:47 PM
Run-time error '5':Invalid Procedure call or argument Jan Refsdal Excel Programming 1 July 25th 03 05:14 AM


All times are GMT +1. The time now is 11:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"