Author Topic: Accessing window zoom from cell formula  (Read 3532 times)

0 Members and 1 Guest are viewing this topic.


  • Jr. Member
  • **
  • Posts: 50
Accessing window zoom from cell formula
« on: July 02, 2010, 02:06:48 AM »
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.


  • Hero Member
  • *****
  • Posts: 1676
Re: Accessing window zoom from cell formula
« Reply #1 on: July 02, 2010, 11:38:50 AM »
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.


  • Full Member
  • ***
  • Posts: 106
Re: Accessing window zoom from cell formula
« Reply #2 on: July 12, 2010, 10:06:37 AM »
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
(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.