Using VBA to open Excel , Auto_Open Procedure not running

M

moonhk

Hi Reader

I have below code for Open Excel by VBA. The Excel have Auto_open
Procedure can not able to run.

I already set Secuiry Level to Low.

How to chang below coding ?


On Error GoTo OpenError
Workbooks.Open Filename:=loFilename, UpdateLinks:=2

On Error GoTo 0
 
C

Chip Pearson

When you open a workbook with VBA code, the Auto_Open macro does not run.
This is by design. You can run them with code like

ActiveWorkbook.RunAutoMacros xlAutoOpen


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
M

moonhk

When you open a workbook with VBA code, the Auto_Open macro does not run.
This is by design. You can run them with code like

ActiveWorkbook.RunAutoMacros xlAutoOpen

--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consultingwww.cpearson.com
(email on the web site)











- -

Than, It works

My coding as below
On Error GoTo OpenError
Workbooks.Open Filename:=loFilename, UpdateLinks:=2
ActiveWorkbook.RunAutoMacros xlAutoOpen

On Error GoTo 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top