VBA 'SHELL' command causes Excel freeze up on new 64bit PC w/64 bit Office

rlv01

Well-known Member
Joined
May 16, 2017
Messages
3,112
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Window 10 64bit, ver 1909
Excel / Office 365 MSO v16

This is my first install of 64 bit office and a weird problem has surfaced. Trying to execute a SHELL command causes Excel to freeze. It goes to "not responding" and (must be killed from Task Manager).

Here is simplified test code that produces the freeze for me (except for one scenario described below):

VBA Code:
Sub ShellTest()
    Dim ShellStr As String
    Dim RetVal
    
    ShellStr = "C:\WINDOWS\NOTEPAD.EXE"
  
    RetVal = Shell(ShellStr, 1)  'freeze occurs when this line is executed
    
    Debug.Print "Function return value: " & RetVal & vbCr
End Sub

Every existing workbook I've tried with a shell command in the vba code behaves this way. But here's the weird part:

If I create a new workbook, then shift to the VBA editor and paste the above code into the code module, then run it from the debugger - it works fine. But if I SAVE the code, then immediately try to run it from the debugger, it freezes.

I've done some web searching, but can't seem to find anything on point. Any thoughts?

Is anyone else out there who is running 64 bit office under Win 10 experiencing similar issues with the VBA shell command?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
No problem with 64 bit Windows 19041 and 64bit Excel 2010.

Have you tried other shell commands?
 
Upvote 0
Nothing other than the vba Shell command. I did more experimenting after posting my message yesterday and found that after a PC reboot, the shell behavior went back to normal. I'm currently loading the applications I usually run and waiting to see if the problem recurs - along with looking at what add-ons are being loaded.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top