1
votes

I have written a simple macro to force end users to view an EULA and then click a command button to accept the terms. On clicking the tabs for the workbook open allowing the user to work through the book. This works fine in Excel 2010 and all previous version but not in Excel 2013.

I get this error: Error Dialogue

This is the code:

Sub OpenSheets()
'
' OpenSheets Macro
'

'
    Sheets("EULA").Select
    Sheets("Infection_Worksheet").Visible = True
    Sheets("Infection_Worksheet").Select
    Sheets("Exit_Site_Infection_Chart").Visible = True
    Sheets("Exit_Site_Infection_Chart").Select
    Sheets("Peritonitis_Chart").Visible = True
    Sheets("Exit_Site_Infection_Chart").Select
    Sheets("%_Pts_peritonitis_free").Visible = True
    Sheets("%_Pts_peritonitis_free").Select
    Sheets("Pt_numbers").Visible = True
    Sheets("Pt_numbers").Select    
    Sheets("Results").Visible = True
    Sheets("Results").Select
    Sheets("Instructions").Visible = True
    End Sub

Does anyone have any suggestions?

1
Where is the error? - 3vts
In xl2016, I get this error if I try to unhide a worksheet that is within a workbook with a protected structure. - user4039065
Are you somehow dealing with a workspace? The workspace was abandoned in xl2013 when MS moved to independent application windows (within a single application instance). - user4039065
The macro runs and opens all the tabs and throws the error I listed above at the end then XL2013 crashes. - Mark Penno
Can you tell us on which line you get the error? - M--

1 Answers

0
votes

Underscores represent continuation to the next line in VBA.

Try this Sheets("Infection" & Chr(97) & "Worksheet").Visible = True

etc etc etc