News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Hide Page?

Started by jeye, October 02, 2017, 06:16:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jeye

I have a Shapesheet - User Defined Cell that calculates a value of either 0 or 1. If the value equals 1 then I want the next page to unhide and be printable. If the value equals 0 then I want the page to be hidden and unprintable.

Is this something that is doable? I've tried placing it on a layer that will leave the page blank but this of course leads to an ugly result.

wapperdude

Visio 2019 Pro

jeye

This hides the page but it is still printable. Is there a solution that hides and doesn't allow printing of the hidden page?

Surrogate

#3
1. Press keys Shift+F5
2. Set this page as background page

jeye

This function works but is there a way to do this through shapesheet?

Surrogate

No, you can't change page setup setting via shapesheet !
Also you can set this page as background using VBA code
Application.ActivePage.Background = True
    Application.ActivePage.BackPage = ""



jeye

Thank you for the information  ;D

jeye

So this is what I've put together so far.

Whenever I change the value of the shape data within the ShapeSheet, it changes the UIVisibility within each page.

For Example

Prop.Row_1 has a value of 5
Pages 1 through 5 are visible

Would it be possible to run the macro using a DEPENDSON value per page as another value changes?

If so, how would I do that?

Surrogate

Add user-defined cell, and place there formula
RUNMACRO("ThisDocument.tst")+DEPENDSON(Prop.Row_1)
After you change value of that property, it run macro for example named tst
(if you document contain this sub routine)

jeye

Thanks Surrogate. Is it possible to run an if statement within the macro?

I.e. IF Row_1.Value = 1 Then
Application.ActivePage.Background = True Else
Application.ActivePage.Background = False
End If

(Sorry, I'm new to ShapeSheets and Macros for Visio)  :'(

Surrogate

Quote from: jeye on October 04, 2017, 10:45:39 PM
Is it possible to run an if statement within the macro?
Of course !
Sub tst()
Dim shp As Shape
Set shp = ActiveWindow.Selection.PrimaryItem
If shp.Cells("Prop.row_1").ResultIU = 1 Then
Application.ActivePage.Background = True
Else
Application.ActivePage.Background = False
End If
End Sub

Surrogate

Also you can use CallThis function. This function can pass parameter to sub routine !
This way have two differences:
1. Add user-defined cell, and place there formula
CALLTHIS("thisdocument.tst",,Prop.Row_1)+DEPENDSON(Prop.Row_1)
2. Code of tst sub routine must contain shp parameter !!!
Sub tst(shp As Shape, vl As Integer)
If vl = 1 Then
Application.ActivePage.Background = True
Else
Application.ActivePage.Background = False
End If
End Sub

jeye

For anyone looking to hide the page and make it not printable.

I created a shape with the shapesheet shape data of:

Prop.row_1, value = page #

I then put this macro into a module:

Sub tst1()
Dim shp As Shape
Dim VsApp As Object
Dim intCounter As Integer
Visio.Application.ScreenUpdating = False

Set shp = ActiveWindow.Selection.PrimaryItem

For intCounter = 1 To 12

If shp.Cells("prop.row_1").ResultIU >= intCounter Then
ActiveWindow.Page = ActiveDocument.Pages("Site" & intCounter)
Application.ActivePage.Background = False
Else
ActiveWindow.Page = ActiveDocument.Pages("Site" & intCounter)
Application.ActivePage.Background = True

End If
ActiveWindow.Page = ActiveDocument.Pages("Page-1")
Application.ActivePage.Background = False
Visio.Application.ScreenUpdating = False

Next intCounter
End Sub


I then Created as user.row_# with the following:
RUNMACRO("Module1.tst1")+DEPENDSON(Prop.row_1)

I then went into the Drawing Explorer, right clicked on the document and clicked view Shapesheet.

Created a user.row_# for each page (# replaced with page #)
IF(Pages[Page-1]!Sheet.####!Prop.row_1>=1,0,1)

I then went into each pages shapesheet and changed the UIVisibility to reference each user.row_#
TheDoc!User.row_1

These are the steps I used to hide the page and make it unprintable. Thanks everyone for their help.


Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 369 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1191KB.
Tokens: post-login.
Cache hits: 13: 0.00206s for 26,726 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]