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

Accessing window zoom from cell formula

Started by IRDC, July 02, 2010, 07:06:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IRDC

Hi,
does anybody know a way to get information about the zoom level in a shape cell formula? I'd like to build shapes where the text stays roughly the same size when you zoom in on a group shape and so showing more of the group shape while not filling the screen with 200px high letters.

vojo

look up "docmd"  calls.   I think there is a bunch of zoom options in there....I know I use to call custom props  "docmd(1312)" from action tasks.

scott

Like you, I don't see a shapesheet function that reads the current zoom level, so I don't think you can do what you want entirely within the shapesheet.

However, you can use the ViewChanged event of the Window object to set a shapesheet cell value and then use that value any way you choose.

Create a user cell in the document sheet called
User.CurrentZoom
(or use any other name you'd like). Then add this code to the document
Public WithEvents wnd As Visio.Window
Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
    Set wnd = ActiveWindow
End Sub
Private Sub wnd_ViewChanged(ByVal Window As IVWindow)
' ensure that the activewindow is the correct window, otherwise don't try to
' update the docsheet cell
    If ActiveWindow Is wnd Then
        ActiveDocument.DocumentSheet.Cells("User.CurrentZoom").Formula = wnd.Zoom
    End If
End Sub


Opening the document sets wnd to the active window and every time you change zoom levels, the line of code in wnd_ViewChanged will set the zoom value into the user cell.

Regards,
Scott

Browser ID: smf (is_webkit)
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: 167 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1072KB.
Tokens: post-login.
Cache hits: 12: 0.00115s for 26,766 bytes (show)
Cache misses: 1: (show)
Queries used: 14.

[Show Queries]