PC Review


Reply
Thread Tools Rate Thread

auto enable macros

 
 
Gordon
Guest
Posts: n/a
 
      25th Sep 2008
Hi..

Going crazy here!

I know there is now way to automate enable macros when loading an excel file
but I've heard that you can use code to leave an introduction page and only
an introduction page and nothing else if macros aren't enabled.

Has anyone seen any code or advice on this? I tried some code that used a
workbook_open macro but I use long auto_run and auto_close code below. So
what I need needs to fit in or work alongside the code below?

Private Sub auto_open()
CommandBars("Worksheet Menu Bar").Enabled = False
Application.DisplayFullScreen = False
Sheets("SETUP").Select
Range("A1").Select
ActiveCell.FormulaR1C1 = "1"
ActiveWindow.Caption = Sheets("SETUP").Range("J6")
Application.DisplayFormulaBar = False
ActiveWindow.DisplayHeadings = False
Application.DisplayStatusBar = False
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.DisplayVerticalScrollBar = False
ActiveWindow.DisplayWorkbookTabs = True
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Chart").Visible = False
Application.CommandBars("Forms").Visible = False
Application.CommandBars("Web").Visible = False
Application.CommandBars("Reviewing").Visible = False
Application.CommandBars("Visual Basic").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.CommandBars("web").Visible = False
Application.CommandBars("Picture").Visible = False
Application.CommandBars("PivotTable").Visible = False
Application.CommandBars("CELL").Enabled = False
Application.CommandBars("Visual Basic").Enabled = False
MenuBars(xlWorksheet).Menus("Data").Enabled = True
MenuBars(xlWorksheet).Menus("Help").Enabled = True
MenuBars(xlWorksheet).Menus("Edit").Enabled = True
MenuBars(xlWorksheet).Menus("Format").Enabled = True
MenuBars(xlWorksheet).Menus("Insert").Enabled = True
MenuBars(xlWorksheet).Menus("Window").Enabled = True
MenuBars(xlWorksheet).Menus("Help").Enabled = True
MenuBars(xlWorksheet).Menus("Tools").Enabled = True
MenuBars(xlWorksheet).Menus("View").Enabled = True
Application.CommandBars("Ply").Enabled = False
End Sub
Sub auto_close()
CommandBars("Worksheet Menu Bar").Enabled = True
Application.DisplayFormulaBar = True
ActiveWindow.DisplayHeadings = True
Application.DisplayStatusBar = True
ActiveWindow.DisplayHorizontalScrollBar = True
ActiveWindow.DisplayVerticalScrollBar = True
ActiveWindow.DisplayWorkbookTabs = True
Application.CommandBars("Standard").Visible = True
Application.CommandBars("Formatting").Visible = True
MenuBars(xlWorksheet).Menus("Data").Enabled = True
MenuBars(xlWorksheet).Menus("Help").Enabled = True
MenuBars(xlWorksheet).Menus("Edit").Enabled = True
MenuBars(xlWorksheet).Menus("Format").Enabled = True
MenuBars(xlWorksheet).Menus("Insert").Enabled = True
MenuBars(xlWorksheet).Menus("Window").Enabled = True
MenuBars(xlWorksheet).Menus("Help").Enabled = True
MenuBars(xlWorksheet).Menus("Tools").Enabled = True
MenuBars(xlWorksheet).Menus("View").Enabled = True
Application.CommandBars("CELL").Enabled = True
Application.CommandBars("Ply").Enabled = True
Sheets("SETUP").Select
Range("A1").Select
Application.DisplayFullScreen = False
ActiveWorkbook.Save
Application.DisplayAlerts = False
Application.Quit

End Sub

Any ideas?


 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      25th Sep 2008
You are using function names from excel 97. You should change the first line
of code as shown below. the macros have to be place in the VBA sheet
Thisworkbook. In VBA menu go to View - Project Explorer and double click
THISWORKBOOK. Place both macros on this page. Change first line.

from
Private Sub auto_open()
to
Private Sub App_WorkbookOpen(ByVal Wb As Workbook)


from
Sub auto_close()
to
Private Sub Workbook_BeforeClose(Cancel as Boolean)



"Gordon" wrote:

> Hi..
>
> Going crazy here!
>
> I know there is now way to automate enable macros when loading an excel file
> but I've heard that you can use code to leave an introduction page and only
> an introduction page and nothing else if macros aren't enabled.
>
> Has anyone seen any code or advice on this? I tried some code that used a
> workbook_open macro but I use long auto_run and auto_close code below. So
> what I need needs to fit in or work alongside the code below?
>
> Private Sub auto_open()
> CommandBars("Worksheet Menu Bar").Enabled = False
> Application.DisplayFullScreen = False
> Sheets("SETUP").Select
> Range("A1").Select
> ActiveCell.FormulaR1C1 = "1"
> ActiveWindow.Caption = Sheets("SETUP").Range("J6")
> Application.DisplayFormulaBar = False
> ActiveWindow.DisplayHeadings = False
> Application.DisplayStatusBar = False
> ActiveWindow.DisplayHorizontalScrollBar = False
> ActiveWindow.DisplayVerticalScrollBar = False
> ActiveWindow.DisplayWorkbookTabs = True
> Application.CommandBars("Standard").Visible = False
> Application.CommandBars("Formatting").Visible = False
> Application.CommandBars("Chart").Visible = False
> Application.CommandBars("Forms").Visible = False
> Application.CommandBars("Web").Visible = False
> Application.CommandBars("Reviewing").Visible = False
> Application.CommandBars("Visual Basic").Visible = False
> Application.CommandBars("Drawing").Visible = False
> Application.CommandBars("web").Visible = False
> Application.CommandBars("Picture").Visible = False
> Application.CommandBars("PivotTable").Visible = False
> Application.CommandBars("CELL").Enabled = False
> Application.CommandBars("Visual Basic").Enabled = False
> MenuBars(xlWorksheet).Menus("Data").Enabled = True
> MenuBars(xlWorksheet).Menus("Help").Enabled = True
> MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> MenuBars(xlWorksheet).Menus("Format").Enabled = True
> MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> MenuBars(xlWorksheet).Menus("Window").Enabled = True
> MenuBars(xlWorksheet).Menus("Help").Enabled = True
> MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> MenuBars(xlWorksheet).Menus("View").Enabled = True
> Application.CommandBars("Ply").Enabled = False
> End Sub
> Sub auto_close()
> CommandBars("Worksheet Menu Bar").Enabled = True
> Application.DisplayFormulaBar = True
> ActiveWindow.DisplayHeadings = True
> Application.DisplayStatusBar = True
> ActiveWindow.DisplayHorizontalScrollBar = True
> ActiveWindow.DisplayVerticalScrollBar = True
> ActiveWindow.DisplayWorkbookTabs = True
> Application.CommandBars("Standard").Visible = True
> Application.CommandBars("Formatting").Visible = True
> MenuBars(xlWorksheet).Menus("Data").Enabled = True
> MenuBars(xlWorksheet).Menus("Help").Enabled = True
> MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> MenuBars(xlWorksheet).Menus("Format").Enabled = True
> MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> MenuBars(xlWorksheet).Menus("Window").Enabled = True
> MenuBars(xlWorksheet).Menus("Help").Enabled = True
> MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> MenuBars(xlWorksheet).Menus("View").Enabled = True
> Application.CommandBars("CELL").Enabled = True
> Application.CommandBars("Ply").Enabled = True
> Sheets("SETUP").Select
> Range("A1").Select
> Application.DisplayFullScreen = False
> ActiveWorkbook.Save
> Application.DisplayAlerts = False
> Application.Quit
>
> End Sub
>
> Any ideas?
>
>

 
Reply With Quote
 
Gordon
Guest
Posts: n/a
 
      25th Sep 2008
Hi Joel...

I did what you said but when I open my file everything that used to happen
within the auto_run now doesn't happen at all.

When I close down the workbook_close macro crashes and none of the code that
was origianlly in the auto_close doesn't fire.

You can see why I've kept with auto_run for so long. I want to move over to
workbook stuff but I don't undertand how it works.

Any tips or advice would be welcome!!!!

Cheers

G

"Joel" wrote:

> You are using function names from excel 97. You should change the first line
> of code as shown below. the macros have to be place in the VBA sheet
> Thisworkbook. In VBA menu go to View - Project Explorer and double click
> THISWORKBOOK. Place both macros on this page. Change first line.
>
> from
> Private Sub auto_open()
> to
> Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
>
>
> from
> Sub auto_close()
> to
> Private Sub Workbook_BeforeClose(Cancel as Boolean)
>
>
>
> "Gordon" wrote:
>
> > Hi..
> >
> > Going crazy here!
> >
> > I know there is now way to automate enable macros when loading an excel file
> > but I've heard that you can use code to leave an introduction page and only
> > an introduction page and nothing else if macros aren't enabled.
> >
> > Has anyone seen any code or advice on this? I tried some code that used a
> > workbook_open macro but I use long auto_run and auto_close code below. So
> > what I need needs to fit in or work alongside the code below?
> >
> > Private Sub auto_open()
> > CommandBars("Worksheet Menu Bar").Enabled = False
> > Application.DisplayFullScreen = False
> > Sheets("SETUP").Select
> > Range("A1").Select
> > ActiveCell.FormulaR1C1 = "1"
> > ActiveWindow.Caption = Sheets("SETUP").Range("J6")
> > Application.DisplayFormulaBar = False
> > ActiveWindow.DisplayHeadings = False
> > Application.DisplayStatusBar = False
> > ActiveWindow.DisplayHorizontalScrollBar = False
> > ActiveWindow.DisplayVerticalScrollBar = False
> > ActiveWindow.DisplayWorkbookTabs = True
> > Application.CommandBars("Standard").Visible = False
> > Application.CommandBars("Formatting").Visible = False
> > Application.CommandBars("Chart").Visible = False
> > Application.CommandBars("Forms").Visible = False
> > Application.CommandBars("Web").Visible = False
> > Application.CommandBars("Reviewing").Visible = False
> > Application.CommandBars("Visual Basic").Visible = False
> > Application.CommandBars("Drawing").Visible = False
> > Application.CommandBars("web").Visible = False
> > Application.CommandBars("Picture").Visible = False
> > Application.CommandBars("PivotTable").Visible = False
> > Application.CommandBars("CELL").Enabled = False
> > Application.CommandBars("Visual Basic").Enabled = False
> > MenuBars(xlWorksheet).Menus("Data").Enabled = True
> > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> > MenuBars(xlWorksheet).Menus("Format").Enabled = True
> > MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> > MenuBars(xlWorksheet).Menus("Window").Enabled = True
> > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> > MenuBars(xlWorksheet).Menus("View").Enabled = True
> > Application.CommandBars("Ply").Enabled = False
> > End Sub
> > Sub auto_close()
> > CommandBars("Worksheet Menu Bar").Enabled = True
> > Application.DisplayFormulaBar = True
> > ActiveWindow.DisplayHeadings = True
> > Application.DisplayStatusBar = True
> > ActiveWindow.DisplayHorizontalScrollBar = True
> > ActiveWindow.DisplayVerticalScrollBar = True
> > ActiveWindow.DisplayWorkbookTabs = True
> > Application.CommandBars("Standard").Visible = True
> > Application.CommandBars("Formatting").Visible = True
> > MenuBars(xlWorksheet).Menus("Data").Enabled = True
> > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> > MenuBars(xlWorksheet).Menus("Format").Enabled = True
> > MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> > MenuBars(xlWorksheet).Menus("Window").Enabled = True
> > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> > MenuBars(xlWorksheet).Menus("View").Enabled = True
> > Application.CommandBars("CELL").Enabled = True
> > Application.CommandBars("Ply").Enabled = True
> > Sheets("SETUP").Select
> > Range("A1").Select
> > Application.DisplayFullScreen = False
> > ActiveWorkbook.Save
> > Application.DisplayAlerts = False
> > Application.Quit
> >
> > End Sub
> >
> > Any ideas?
> >
> >

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      25th Sep 2008
I singled step through the code and it worked fine in Excel 2003. I simply
commented out the parameter list to be able to step through the code. Only
event subs can have parameter lists. cheange the code like I did below.
Then Press the Sub line with the mouse and Press F8. Keep pressing F8 until
the code fails. Then repeat with the close macro.

I would also change a VBA setting to break on ALL errors

Tools - Options - General - Break on All Errors

I think the open code sets up the menu the way the defaults are set in excel
2003 so you may not see any changes. The close macro saves the file and
there may be a problem with the saving. Good Luck!


Private Sub App_WorkbookOpen() '(ByVal Wb As Workbook)

Private Sub Workbook_BeforeClose() '(Cancel As Boolean)

"Gordon" wrote:

> Hi Joel...
>
> I did what you said but when I open my file everything that used to happen
> within the auto_run now doesn't happen at all.
>
> When I close down the workbook_close macro crashes and none of the code that
> was origianlly in the auto_close doesn't fire.
>
> You can see why I've kept with auto_run for so long. I want to move over to
> workbook stuff but I don't undertand how it works.
>
> Any tips or advice would be welcome!!!!
>
> Cheers
>
> G
>
> "Joel" wrote:
>
> > You are using function names from excel 97. You should change the first line
> > of code as shown below. the macros have to be place in the VBA sheet
> > Thisworkbook. In VBA menu go to View - Project Explorer and double click
> > THISWORKBOOK. Place both macros on this page. Change first line.
> >
> > from
> > Private Sub auto_open()
> > to
> > Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
> >
> >
> > from
> > Sub auto_close()
> > to
> > Private Sub Workbook_BeforeClose(Cancel as Boolean)
> >
> >
> >
> > "Gordon" wrote:
> >
> > > Hi..
> > >
> > > Going crazy here!
> > >
> > > I know there is now way to automate enable macros when loading an excel file
> > > but I've heard that you can use code to leave an introduction page and only
> > > an introduction page and nothing else if macros aren't enabled.
> > >
> > > Has anyone seen any code or advice on this? I tried some code that used a
> > > workbook_open macro but I use long auto_run and auto_close code below. So
> > > what I need needs to fit in or work alongside the code below?
> > >
> > > Private Sub auto_open()
> > > CommandBars("Worksheet Menu Bar").Enabled = False
> > > Application.DisplayFullScreen = False
> > > Sheets("SETUP").Select
> > > Range("A1").Select
> > > ActiveCell.FormulaR1C1 = "1"
> > > ActiveWindow.Caption = Sheets("SETUP").Range("J6")
> > > Application.DisplayFormulaBar = False
> > > ActiveWindow.DisplayHeadings = False
> > > Application.DisplayStatusBar = False
> > > ActiveWindow.DisplayHorizontalScrollBar = False
> > > ActiveWindow.DisplayVerticalScrollBar = False
> > > ActiveWindow.DisplayWorkbookTabs = True
> > > Application.CommandBars("Standard").Visible = False
> > > Application.CommandBars("Formatting").Visible = False
> > > Application.CommandBars("Chart").Visible = False
> > > Application.CommandBars("Forms").Visible = False
> > > Application.CommandBars("Web").Visible = False
> > > Application.CommandBars("Reviewing").Visible = False
> > > Application.CommandBars("Visual Basic").Visible = False
> > > Application.CommandBars("Drawing").Visible = False
> > > Application.CommandBars("web").Visible = False
> > > Application.CommandBars("Picture").Visible = False
> > > Application.CommandBars("PivotTable").Visible = False
> > > Application.CommandBars("CELL").Enabled = False
> > > Application.CommandBars("Visual Basic").Enabled = False
> > > MenuBars(xlWorksheet).Menus("Data").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Format").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Window").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> > > MenuBars(xlWorksheet).Menus("View").Enabled = True
> > > Application.CommandBars("Ply").Enabled = False
> > > End Sub
> > > Sub auto_close()
> > > CommandBars("Worksheet Menu Bar").Enabled = True
> > > Application.DisplayFormulaBar = True
> > > ActiveWindow.DisplayHeadings = True
> > > Application.DisplayStatusBar = True
> > > ActiveWindow.DisplayHorizontalScrollBar = True
> > > ActiveWindow.DisplayVerticalScrollBar = True
> > > ActiveWindow.DisplayWorkbookTabs = True
> > > Application.CommandBars("Standard").Visible = True
> > > Application.CommandBars("Formatting").Visible = True
> > > MenuBars(xlWorksheet).Menus("Data").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Format").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Window").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Help").Enabled = True
> > > MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> > > MenuBars(xlWorksheet).Menus("View").Enabled = True
> > > Application.CommandBars("CELL").Enabled = True
> > > Application.CommandBars("Ply").Enabled = True
> > > Sheets("SETUP").Select
> > > Range("A1").Select
> > > Application.DisplayFullScreen = False
> > > ActiveWorkbook.Save
> > > Application.DisplayAlerts = False
> > > Application.Quit
> > >
> > > End Sub
> > >
> > > Any ideas?
> > >
> > >

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      25th Sep 2008

See http://www.cpearson.com/Excel/EnableMacros.aspx and
http://www.cpearson.com/Excel/EnableMacros2.aspx

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
The San Diego Project Group, LLC
(email is on the web site)
USA Central Daylight Time (-5:00 GMT)


On Thu, 25 Sep 2008 09:29:00 -0700, Gordon
<(E-Mail Removed)> wrote:

>Hi..
>
>Going crazy here!
>
>I know there is now way to automate enable macros when loading an excel file
>but I've heard that you can use code to leave an introduction page and only
>an introduction page and nothing else if macros aren't enabled.
>
>Has anyone seen any code or advice on this? I tried some code that used a
>workbook_open macro but I use long auto_run and auto_close code below. So
>what I need needs to fit in or work alongside the code below?
>
>Private Sub auto_open()
>CommandBars("Worksheet Menu Bar").Enabled = False
>Application.DisplayFullScreen = False
>Sheets("SETUP").Select
>Range("A1").Select
>ActiveCell.FormulaR1C1 = "1"
>ActiveWindow.Caption = Sheets("SETUP").Range("J6")
>Application.DisplayFormulaBar = False
>ActiveWindow.DisplayHeadings = False
>Application.DisplayStatusBar = False
>ActiveWindow.DisplayHorizontalScrollBar = False
>ActiveWindow.DisplayVerticalScrollBar = False
>ActiveWindow.DisplayWorkbookTabs = True
>Application.CommandBars("Standard").Visible = False
>Application.CommandBars("Formatting").Visible = False
>Application.CommandBars("Chart").Visible = False
>Application.CommandBars("Forms").Visible = False
>Application.CommandBars("Web").Visible = False
>Application.CommandBars("Reviewing").Visible = False
>Application.CommandBars("Visual Basic").Visible = False
>Application.CommandBars("Drawing").Visible = False
>Application.CommandBars("web").Visible = False
>Application.CommandBars("Picture").Visible = False
>Application.CommandBars("PivotTable").Visible = False
>Application.CommandBars("CELL").Enabled = False
>Application.CommandBars("Visual Basic").Enabled = False
>MenuBars(xlWorksheet).Menus("Data").Enabled = True
>MenuBars(xlWorksheet).Menus("Help").Enabled = True
>MenuBars(xlWorksheet).Menus("Edit").Enabled = True
>MenuBars(xlWorksheet).Menus("Format").Enabled = True
>MenuBars(xlWorksheet).Menus("Insert").Enabled = True
>MenuBars(xlWorksheet).Menus("Window").Enabled = True
>MenuBars(xlWorksheet).Menus("Help").Enabled = True
>MenuBars(xlWorksheet).Menus("Tools").Enabled = True
>MenuBars(xlWorksheet).Menus("View").Enabled = True
>Application.CommandBars("Ply").Enabled = False
>End Sub
>Sub auto_close()
>CommandBars("Worksheet Menu Bar").Enabled = True
>Application.DisplayFormulaBar = True
>ActiveWindow.DisplayHeadings = True
>Application.DisplayStatusBar = True
>ActiveWindow.DisplayHorizontalScrollBar = True
>ActiveWindow.DisplayVerticalScrollBar = True
>ActiveWindow.DisplayWorkbookTabs = True
>Application.CommandBars("Standard").Visible = True
>Application.CommandBars("Formatting").Visible = True
>MenuBars(xlWorksheet).Menus("Data").Enabled = True
>MenuBars(xlWorksheet).Menus("Help").Enabled = True
>MenuBars(xlWorksheet).Menus("Edit").Enabled = True
>MenuBars(xlWorksheet).Menus("Format").Enabled = True
>MenuBars(xlWorksheet).Menus("Insert").Enabled = True
>MenuBars(xlWorksheet).Menus("Window").Enabled = True
>MenuBars(xlWorksheet).Menus("Help").Enabled = True
>MenuBars(xlWorksheet).Menus("Tools").Enabled = True
>MenuBars(xlWorksheet).Menus("View").Enabled = True
>Application.CommandBars("CELL").Enabled = True
>Application.CommandBars("Ply").Enabled = True
>Sheets("SETUP").Select
>Range("A1").Select
>Application.DisplayFullScreen = False
>ActiveWorkbook.Save
>Application.DisplayAlerts = False
>Application.Quit
>
>End Sub
>
>Any ideas?
>

 
Reply With Quote
 
Gordon
Guest
Posts: n/a
 
      25th Sep 2008
Hi Chris...

Thanks for this. I understand the principals but I'm dammed if I can
dovetail it into my file. I've spent 3 days trying to get this right. I came
across these links 2 days ago.

Best option: Why don't I pay you £50 by paypal right now and send you the
file I need fixing? You spend 10 minutes on it and I'm a happy bunny!

Feel free to respond on (E-Mail Removed)

Cheers

G

"Chip Pearson" wrote:

>
> See http://www.cpearson.com/Excel/EnableMacros.aspx and
> http://www.cpearson.com/Excel/EnableMacros2.aspx
>
> Cordially,
> Chip Pearson
> Microsoft MVP
> Excel Product Group
> Pearson Software Consulting, LLC
> www.cpearson.com
> The San Diego Project Group, LLC
> (email is on the web site)
> USA Central Daylight Time (-5:00 GMT)
>
>
> On Thu, 25 Sep 2008 09:29:00 -0700, Gordon
> <(E-Mail Removed)> wrote:
>
> >Hi..
> >
> >Going crazy here!
> >
> >I know there is now way to automate enable macros when loading an excel file
> >but I've heard that you can use code to leave an introduction page and only
> >an introduction page and nothing else if macros aren't enabled.
> >
> >Has anyone seen any code or advice on this? I tried some code that used a
> >workbook_open macro but I use long auto_run and auto_close code below. So
> >what I need needs to fit in or work alongside the code below?
> >
> >Private Sub auto_open()
> >CommandBars("Worksheet Menu Bar").Enabled = False
> >Application.DisplayFullScreen = False
> >Sheets("SETUP").Select
> >Range("A1").Select
> >ActiveCell.FormulaR1C1 = "1"
> >ActiveWindow.Caption = Sheets("SETUP").Range("J6")
> >Application.DisplayFormulaBar = False
> >ActiveWindow.DisplayHeadings = False
> >Application.DisplayStatusBar = False
> >ActiveWindow.DisplayHorizontalScrollBar = False
> >ActiveWindow.DisplayVerticalScrollBar = False
> >ActiveWindow.DisplayWorkbookTabs = True
> >Application.CommandBars("Standard").Visible = False
> >Application.CommandBars("Formatting").Visible = False
> >Application.CommandBars("Chart").Visible = False
> >Application.CommandBars("Forms").Visible = False
> >Application.CommandBars("Web").Visible = False
> >Application.CommandBars("Reviewing").Visible = False
> >Application.CommandBars("Visual Basic").Visible = False
> >Application.CommandBars("Drawing").Visible = False
> >Application.CommandBars("web").Visible = False
> >Application.CommandBars("Picture").Visible = False
> >Application.CommandBars("PivotTable").Visible = False
> >Application.CommandBars("CELL").Enabled = False
> >Application.CommandBars("Visual Basic").Enabled = False
> >MenuBars(xlWorksheet).Menus("Data").Enabled = True
> >MenuBars(xlWorksheet).Menus("Help").Enabled = True
> >MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> >MenuBars(xlWorksheet).Menus("Format").Enabled = True
> >MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> >MenuBars(xlWorksheet).Menus("Window").Enabled = True
> >MenuBars(xlWorksheet).Menus("Help").Enabled = True
> >MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> >MenuBars(xlWorksheet).Menus("View").Enabled = True
> >Application.CommandBars("Ply").Enabled = False
> >End Sub
> >Sub auto_close()
> >CommandBars("Worksheet Menu Bar").Enabled = True
> >Application.DisplayFormulaBar = True
> >ActiveWindow.DisplayHeadings = True
> >Application.DisplayStatusBar = True
> >ActiveWindow.DisplayHorizontalScrollBar = True
> >ActiveWindow.DisplayVerticalScrollBar = True
> >ActiveWindow.DisplayWorkbookTabs = True
> >Application.CommandBars("Standard").Visible = True
> >Application.CommandBars("Formatting").Visible = True
> >MenuBars(xlWorksheet).Menus("Data").Enabled = True
> >MenuBars(xlWorksheet).Menus("Help").Enabled = True
> >MenuBars(xlWorksheet).Menus("Edit").Enabled = True
> >MenuBars(xlWorksheet).Menus("Format").Enabled = True
> >MenuBars(xlWorksheet).Menus("Insert").Enabled = True
> >MenuBars(xlWorksheet).Menus("Window").Enabled = True
> >MenuBars(xlWorksheet).Menus("Help").Enabled = True
> >MenuBars(xlWorksheet).Menus("Tools").Enabled = True
> >MenuBars(xlWorksheet).Menus("View").Enabled = True
> >Application.CommandBars("CELL").Enabled = True
> >Application.CommandBars("Ply").Enabled = True
> >Sheets("SETUP").Select
> >Range("A1").Select
> >Application.DisplayFullScreen = False
> >ActiveWorkbook.Save
> >Application.DisplayAlerts = False
> >Application.Quit
> >
> >End Sub
> >
> >Any ideas?
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable macros - security settings are at "enable all macros" Vie Microsoft Excel Programming 1 29th Sep 2008 03:17 PM
choose default macros Not Enabled / Macros Enable Setting =?Utf-8?B?QkVFSkFZ?= Microsoft Excel Programming 2 30th Jun 2006 01:07 PM
VBA select default Don't Enable / Enable macros Setting =?Utf-8?B?QkVFSkFZ?= Microsoft Excel Programming 1 29th Jun 2006 08:45 PM
Removing Excel message to enable macros or disable macros =?Utf-8?B?Ym1pbGxlcjI2Mw==?= Microsoft Excel Misc 2 13th Oct 2004 02:39 PM
Re: The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros. Sue Mosher [MVP-Outlook] Microsoft Outlook Installation 0 17th Feb 2004 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:58 PM.