1

We have a spreadsheet provided to us from another company. The VBAProject is protected and I do not know the password. On worksheet "Main" there is a RectangleRoundedCorners shape which has the macro assigned ("CREATE SAP JOB RUN LIST").

We are trying to automate our process with VBA but we have a roadblock in triggering the "CREATE SAP JOB RUN LIST" macro.

I do not know what module the macro is in. I cannot cycle all the VBA components as the VBAProject is protected.

Due to the error message I receive (after trying to simulate the call within a workbook of my own) I suspect the macro may be in the "ThisWorkbook" module.

Application.Run workbookname!macroname 

will not work: Run-time error '1004' Cannot run the macro 'workbookname!macroname'. The macro may not be available in this workbook or all macros may be disabled.

Macros are not disabled.

I cannot seem to call the macro directly with VBA, so I was hoping it is possible to simulate the click on the shape. I am struggling to find the appropriate code.

Can anyone assist please?

Thanks in advance

Hemanth Gowda
  • 11
  • 1
  • 6
  • It’s easier to first get the protection off. Just do a search on this site. – EvR Oct 16 '18 at 11:56
  • As @EvR suggested - [this](https://stackoverflow.com/questions/1026483/is-there-a-way-to-crack-the-password-on-an-excel-vba-project) link may help. – Darren Bartrup-Cook Oct 16 '18 at 13:02

1 Answers1

1

Try passing the OnAction property of the Shape object to Application.Run...

Application.Run Workbooks("Book1.xlsm").Worksheets("Sheet1").Shapes("Rectangle 1").OnAction

Change the references to the workbook, worksheet, and shape, accordingly.

Domenic
  • 7,844
  • 2
  • 9
  • 17