excel - Forcing to turn on macros and then display userform once macros are on -


i have issue not sure if can work. using excel 2013 , have code force macros turned on. displays worksheet makes user turn on macros, , hides other sheets. once workbook re-opened, remaining worksheets displayed , macro sheet hidden. trying display macro sheet tell user turn on macros. once workbook re-opened, want display userform before workbook opened. code have forcing user turn on macros follows:

option explicit const origsave string = "c:\sdk engineering\imudcalc software" const origwrkbksave string = "c:\sdk engineering\imudcalc software\imudcalc.xlsm"  private sub workbook_beforeclose(cancel boolean) dim ws worksheet  'don't display workbook application.visible = false  'unhide starting sheet sheets("warning").visible = xlsheetvisible  each ws in thisworkbook.worksheets     if ws.name <> "warning"         ws.visible = xlveryhidden     end if next ws  if len(dir(origsave)) > 0     mkdir (origsave) else     activeworkbook.savecopyas (origwrkbksave) end if end sub  private sub workbook_open() dim ws worksheet  application.visible = false      each ws in thisworkbook.worksheets         ws.visible = xlsheetvisible     next ws      sheets("warning").visible = xlveryhidden      'this need workbook stay invisible , display userform if macros enabled...     frmonload.show  end sub 

can possibly issue? hope i've explained well.

i believe you're looking this.

modify needed.

place in thisworkbook

private sub workbook_beforeclose(cancel boolean) sheets("warning").visible = xlsheetvisible dim ws each ws in thisworkbook.worksheets     if ws.name <> "warning" ws.visible = xlveryhidden next ws thisworkbook.save end sub private sub workbook_open() dim ws each ws in thisworkbook.worksheets     if ws.name <> "warning" ws.visible = xlsheetvisible next ws sheets("warning").visible = xlveryhidden end sub 

example:

demo


Comments