Consulting

Results 1 to 4 of 4

Thread: Visio 07 - sometimes shapes/layers won't hide

  1. #1
    VBAX Newbie
    Joined
    Dec 2007
    Posts
    4
    Location

    Visio 07 - sometimes shapes/layers won't hide

    Hi there.

    I have a visio 2007 application I inherited, the previous people had used most the macro recorder to meet their custom VBA needs. I am trying to understand the auto-code here, but am having trouble debugging something. This related to hiding certain shapes in a specific layer that will not go away.

    On the sheet, there is a "Show Menu" button. If it is double-clicked it runs a function to pop up several new menu buttons (when those menu buttons are clicked, they run other custom functions). This all works fine.

    When the "Show Menu" button is clicked a second time, it is supposed to hide the menu buttons that have popped up. This partially works - it will hide any of those menu buttons that were NOT used, but any of them that were used will continue to stay visible - and I can not figure out why!!


    This is how the VBA code is currently written for toggling the menu buttons on and off (in the "Show Menu" button function). I understand the general gist of how it works, but I must be missing something.


    Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item("myMenuButtons")
    
       If vsoLayer1.CellsC(visLayerVisible).FormulaU = "0"
          Then vsoLayer1.CellsC(visLayerVisible).FormulaU = "1"
       Endif
    
       If vsoLayer1.CellsC(visLayerVisible).FormulaU = "1"
          Then vsoLayer1.CellsC(visLayerVisible).FormulaU = "0"
       Endif
    The only thing I can think of is that when the menu buttons are clicked they are being taken out of their layer, or locked from being modified or something somehow. I know there is code for each menu button as well that is not posted here, but it didn't seem like it would affect their visibility... I mean they should still be part of the layer, right? I can try to post that too if anyone thinks it would be helpful...

    Any thoughts?

    Thank you!!

  2. #2
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    Hi rokuk,
    not knowing anything about visio 2007 try this

    [VBA]
    Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item("myMenuButtons")
    If vsoLayer1.CellsC(visLayerVisible).FormulaU = "0" Then
    vsoLayer1.CellsC(visLayerVisible).FormulaU = "1"
    ElseIf vsoLayer1.CellsC(visLayerVisible).FormulaU = "1" Then
    vsoLayer1.CellsC(visLayerVisible).FormulaU = "0"
    End If

    [/VBA]

  3. #3
    VBAX Newbie
    Joined
    Dec 2007
    Posts
    4
    Location
    Thank you kindly for your response = )

    This results in the same behaviour, unfortunately...

    I notice one thing: when I put in a:

    [VBA]MsgBox(visLayerName)[/VBA]

    it returns a "0" ... I thought I should get it to return "myMenuButtons" instead... am I mistaken? does this mean anything?

  4. #4
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    This should show you the "myMenuButtons"
    [VBA]Msgbox(vsoLayer1.Name)[/VBA]

    I have no idea what visLayerName is. It is not defined so far as what has been posted. Also I would think that the visible property would be vsoLayer1.Visible not vsoLayer1.CellsC(visLayerVisible).FormulaU

    But as already stated I do not know visio and have no access to test it with, I have to depend on you to help me help you unless someone else that knows visio will post.

    What is CellsC? Is that supposed to be Cells?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •