Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hide Excel Sheets-NPrinting

hi experts..

       i have an excel report and it had 7 worksheet like sheet1,sheet2... i sent this report to three users with session access. user1 can see the first three worksheet , user 2 can see sheet 7 and sheet 6 , and the user 3 can see sheet 5,6,7.

  my problem is when user 1 receive and open the report first three sheet he can see with value and the other sheets shows data disabled

because of the session access but i need fully hide those sheet which is have session access it ll not shows data disabled that ful sheets need hide like below

Capture4.PNG

how can i do this??

3 Replies
nilapril2010
Contributor III
Contributor III

Hi,

Apply the macro logic and check

Sub sbHideASheet()

    If Sheet1.ProtectContents Then

        Sheet1.Visible = False

    Else

        Sheet1.Visible = True

    End If

    If Sheet2.ProtectContents Then

        Sheet2.Visible = False

    Else

        Sheet2.Visible = True

    End If

End Sub

Regards

Nilanjan

Not applicable
Author

hi nilapril2010

Thanks for your suggetion

how to enable the macro in NPrinting can you please suggesting by proper steps..

nilapril2010
Contributor III
Contributor III

Embed the macro in your template.

Modify your template -> Go to Developer->Open the visual besic editor -> Write your macro there.

Private Sub Workbook_Open()

     Call sbHideASheet()

End Sub

Sub sbHideASheet()

    If Sheet1.ProtectContents Then

        Sheet1.Visible = False

    Else

        Sheet1.Visible = True

    End If

    If Sheet2.ProtectContents Then

        Sheet2.Visible = False

    Else

        Sheet2.Visible = True

    End If

End Sub

Regards

Nilanjan