Good afternoon :) I've written a bit of code that when my workbook is opened, it makes sure a particular sheet is visible and then activated/selected. After it has done this, it makes sure all [I]inactive[/I] sheets are marked as xlSheetVeryHidden. The code works fine when opened up from 'My Documents'... The issue I'm having is, all other users will be viewing a read only version, which is linked from an internal website. Opening from there has Excel open in protected view... When users click 'Enable Content', they get the following error message: [I]Run-time error '1004': Method 'Activate' of object'_Worksheet' failed[/I] It doesn't stop my sheet from opening, and it seems to open at the correct page... Just it fails to bring up an important message box I want users to see when the document is opened. My code in the 'ThisWorkbook' module and is as follows:
If someone could provide a solution to this problem, it would be greatly appreciated. Thank you. Regards Martin
Private Sub Workbook_Open() Application.ScreenUpdating = False Dim ws As Worksheet With Home .Visible = xlSheetVisible .Activate End With For Each ws In ThisWorkbook.Worksheets If ws.Name <> ThisWorkbook.ActiveSheet.Name Then ws.Visible = xlSheetVeryHidden End If Next ws MsgBox "Please do not save this tool locally. Always open from Nexus to make sure you're using the most up to date prices" Application.ScreenUpdating = True End Sub
This question generated 10 answers. To proceed to the answers, click here.
This thread is current as of November 13, 2017.