0

I am opening an Excel (.xlsm) workbook using a .bat file.

@echo off
pushd \\Network123\Folder123\
"Retrieve.xlsm"

Note: I need to open the file using command line as the macros I need to use are in an Excel COMAdd-in that does not load when opened using (below) in VBscript.

Dim oXLApp As Object, wb As Object
Set oXLApp = CreateObject("Excel.Application")
Set wb = oXLApp.Workbooks.Open("C:\Sample.xlsm")

The following thread aims to treat this issue: Excel add-in not loading when opening Excel from VBA This thread does not provide me a reliable solution.

When I open this file using .bat file I get the same login window (Excel COMAdd-in) as I would by double-clicking. [desired outcome]

My problem: I am able to sign-in to the COMAdd-in using a VBA Macro. I am; however, unable to run this macro without closing out of the login window. The ways I can close this window a) are clicking X top right corner b) Alt+F4

My questions are the following:

1) Is there a way I can target this login-window and pass Alt+F4 using sendkeys and VBscript? Is there a way I can reference this window?

2) Is there a way that I can suppress this window from opening at start-up without interfering with the unload of the .xla?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.