In Win 10 while running an Excel program, I have a button which executes a VB. module. In the module is the statement Process.Start ("Batfile.bat"). Batfile.bat is in the same directory as the Excel file. Batfile's contents are simply
pause
msg * List Created!
Here is the full code:
Sub Worksheets_to_txt()
'<--Saves each worksheet as a text file with the same name
    Dim CalcState As Long
    Dim EventState As Boolean
    Dim PageBreakState As Boolean
    
    Application.ScreenUpdating = False
'    EventState = Application.EnableEvents
'    Application.EnableEvents = False
    CalcState = Application.Calculation
    Application.Calculation = xlCalculationManual
    PageBreakState = ActiveSheet.DisplayPageBreaks
    ActiveSheet.DisplayPageBreaks = False
    Dim ws As Worksheet
    Dim relativePath As String
    Dim answer As VbMsgBoxResult
    relativePath = ActiveWorkbook.Path
    
'    answer = MsgBox("Are you sure you want to export worksheets?", vbYesNo, "Run Macro") '<--Pop up box to confirm export
    Process.Start ("Batfile.bat")
'    If answer = vbYes Then
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    For Each ws In ActiveWorkbook.Worksheets
        ws.Select
        ws.Copy
        ActiveWorkbook.SaveAs Filename:= _
        relativePath & "\" & ws.Name & ".txt", _
        FileFormat:=xlText, CreateBackup:=False
        ActiveWorkbook.Close
        ActiveWorkbook.Activate
    Next
    Worksheets("Master").Activate
    MsgBox "Text files have been created."
'     End If
    
    ActiveSheet.DisplayPageBreaks = PageBreakState
    Application.Calculation = CalcState
'    Application.EnableEvents = EventState
    Application.ScreenUpdating = True
End Sub
This runs fine when I execute it outside of Excel by itself, but pushing the button in excel gives me
Run-time error "424":
Object Required
I have tried a number of online remedies, but I keep getting the same result. What am I doing wrong?