ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto_open MAcro (https://www.excelbanter.com/excel-programming/428051-auto_open-macro.html)

John McCabe

Auto_open MAcro
 
I have a TOC(table of contents) macro and it works great. Also have the
auto_open macro to start on the first sheet.
Trying to give users the option of creating the TOC sheet and then of course
always start on that sheet. But would have NO auto_open unless they
actually want the TOC sheet to be there. Somehow is there a way to have the
TOC macro create also the auto open macro



Bob Phillips[_3_]

Auto_open MAcro
 
Dim StartLine As Long

With ActiveWorkbook.VBProject.VBComponents("Module1").C odeModule
.InsertLines .CountOfLines, _
"Public Sub Auto_Open()" & vbCrLf & _
"Dim ans" & vbCrLf & _
" ans = Msgbox( ""All OK"",vbYesNo)" & vbCrLf & _
" If ans = vbNo Then Cancel = True" & vbCrLf & _
"End Sub"
End With



--
__________________________________
HTH

Bob

"John McCabe" wrote in message
ng.com...
I have a TOC(table of contents) macro and it works great. Also have the
auto_open macro to start on the first sheet.
Trying to give users the option of creating the TOC sheet and then of
course always start on that sheet. But would have NO auto_open unless
they actually want the TOC sheet to be there. Somehow is there a way to
have the TOC macro create also the auto open macro






All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com