what is a good way to autorun macros upon open

crazian picture crazian · Oct 16, 2013 · Viewed 41.1k times · Source

I've tried using the code that many sites have suggested to autorun a list of macros upon opening an Excel workbook. Attached is my VBA code on ThisWorkbook:

Private Sub WorkbookOpen()


MsgBox "STOP!  Do NOT attempt to highlight any fields manually!" & vbCrLf & _
     "Any highlighting will be overwritten upon reentry of this workbook.", vbOKOnly     +vbExclamation

Call Melanoma.ReformatDeplete
Call Melanoma.CScheckNO
Call Melanoma.CScheckMissing
Call Glioma.ReformatDeplete
Call Glioma.ReformatGBM
Call Glioma.CScheckNO
Call Glioma.CScheckMissing
Call Breast.ReformatDeplete
Call Breast.CScheckNO
Call Breast.CScheckMissing
Call Lymphoma.ReformatDeplete
Call Lymphoma.CScheckNO
Call Lymphoma.CScheckMissing
Call Lung.ReformatDeplete
Call Lung.CScheckNO
Call Lung.CScheckMissing
Call Miscellaneous.ReformatDeplete
Call Miscellaneous.CScheckNO
Call Miscellaneous.CScheckMissing
Call Normals.ReformatDeplete
Call Normals.CScheckNO
Call Normals.CScheckMissing


End Sub

Obviously, I saved the workbook as a 2010 macro-enabled workbook, but when I open the workbook, nothing happens on its on, I still have to click the "run button" in VBA

Any suggestions?

Thanks!

Answer

Automate This picture Automate This · Oct 16, 2013

You are close, just add the underscore

Private Sub Workbook_Open()