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

rlv01

Well-known Member
Joined
May 16, 2017
Messages
1,139
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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,878
Office Version
  1. 2010
Platform
  1. Windows
No problem with 64 bit Windows 19041 and 64bit Excel 2010.

Have you tried other shell commands?
 

rlv01

Well-known Member
Joined
May 16, 2017
Messages
1,139
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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.
 

Forum statistics

Threads
1,147,474
Messages
5,741,342
Members
423,656
Latest member
Medrok2021

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
Top