Why does workbook turns hidden after vba executes

Here is the sub

Sub test()
With ThisWorkbook
.Worksheets("Sheet1").Range("A1").Value = 5
End With
End Sub

Here is the vbscript that starts the sub

dim eApp
set eApp = GetObject("C:\Users\Owner\Desktop\Book1.xlsm")
eApp.Application.Run "Book1.xlsm!test"
set eApp = nothing

It executes fine but the workbook gets hidden for some reason . I have to unhide it View - -> Unhide

Why does this happen and how to fix it


A clearer way of running your vbs would be as follows

Dim ObjExcel, ObjWB
Set ObjExcel = CreateObject("excel.application")
Set ObjWB = ObjExcel.Workbooks.Open("C:\Users\Owner\Desktop\Book1.xlsm")
'make it visible
ObjExcel.Visible = True
ObjExcel.Run "Book1.xlsm!test"
ObjWB.Close False
Set ObjExcel = Nothing

Need Your Help

File permission issue with Mac/Windows when using git

windows git macos file-permissions

I ran the following code to pull files from windows git repository.