Runtime error '70' in macro launching .bat after switching to Windows 10

joaobronze

New Member
Joined
Dec 6, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
After switching from Windows 7 to Windows 10, the script for extracting data, transforming it and uploading into database has stopped working. It gets stuck at part, which starts a bat file responsible for uploading a text file into the database. Error appears at line: oShell.Run



VBA Code:
Sub Upload_to_ICW(ScrName As String)
    Dim oShell As Object
    Dim sPathScr
    Set oShell = CreateObject("WScript.Shell")
    
    sPathScr = "v:\path\"
    oShell.Run Chr(34) & sPathScr & ScrName & ".bat" & Chr(34) & " " & Chr(34) & sPathScr & Chr(34), 2, True

End Sub


I've tried messing around in trust center settings to no avail. Some users reported that it might've been related to office 365 privacy settings (but haven't reported what specifically). The path is definitely correct, it works fine on Windows 7 computer. All drive mappings are exactly the same.

Any idea how to go about this or perhaps what to specifically look for in privacy settings or is it just Windows 10 that doesn't allow to run bat files that way anymore ?

Running the .bat file manually works fine.
 

Attachments

  • runtimerrror70.PNG
    runtimerrror70.PNG
    22.6 KB · Views: 4

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Make sure you can access the file in W10 file explorer to ensure no permissions were altered when the OS switch was made.
If allowed, try turning off your anti virus app and then test.
 
Upvote 0

Forum statistics

Threads
1,214,857
Messages
6,121,948
Members
449,056
Latest member
FreeCricketId

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