Forum Discussion

F_Stoelwinder's avatar
F_Stoelwinder
Copper Contributor
Aug 22, 2020

Excel VBA SHELL function does not work anymore

Recently I switched from Windows 7 to Windows 10 and I

use Excel 2016. With W7 the VBA 'SHELL' function worked fine, but now I get an error message (error code 5). I am using the same Excel worksheet as with W7.

Why does this simple script work in Excel and W7 and not in Excel and W10?

 

Sub openP3d()

' openen van P3d

Shell ("C:\P3d\Prepar3D.exe")
End Sub

 

Does anyone have any suggestion to fix this problem?

Many thanks in advanced

 

 

2 Replies

  • Kattalin64's avatar
    Kattalin64
    Copper Contributor

    hi,

    I've got the same problem. I tryed your solution but the problem is the same. Before using the script, I open an application which opens 3 differents windows. I need to research the windows that I need to reload this page with new information.This is my script which work fine with W98:

     

    Dim winShell As New ShellWindows

    Dim IE6 As InternetExplorer

    Dim IE8 As InternetExplorer

    Dim IE9 As InternetExplorer

     

    Set IE6 = CreateObject("InternetExplorer.Application")

    For Each IE6 In winShell

        If IE6.LocationURL = page Then

            IE6.navigate ("https://xxxxxxxxxxx")

        End If

    Next IE6

     

    Now I've got an message "erreur execution70" permission refusée

     

    Can you help me?

    Thanks

  • Thanisalbert's avatar
    Thanisalbert
    Copper Contributor

    F_Stoelwinder 

     

    Set shellwindows = GetObject("new:9ba05972-f6a8-11cf-a442-00a0c90a8f39")
    Set itemobj = shellwindows.Item()
    itemobj.document.Application.ShellExecute sTempBAT, "", "", "open", 0

     

    Please check the below blog

    https://blog.sevagas.com/IMG/pdf/bypass_windows_defender_attack_surface_reduction.pdf

Resources