简体   繁体   中英

Running an Excel macro from another workbook

I have a subroutine that opens a workbook containing a macro. I then want to run that macro. My code looks like this:

Source = "C:\Users\208896\Desktop\Moje Makra\newidea-inbound-query.xlsm"

Workbooks.Open (Source)

Application.Run "newidea-inbound-query.xlsm!InboundQueryMacro"

The name of the macro is correct, it is in Module1, all macros are enabled.

I get the error:

Macro may not be available in this workbook or all macros may be disabled

Application.Run ("'Name of the book'!ModuleName.SubName")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM