zaloudek

How can I turn a bitmap image in my layout on/off with a userform?

Discussion created by zaloudek on Nov 12, 2010
Here's what I'm trying to do...  I have an mxd with a userform that has various options, including a checkbox that is used to change whether a bitmap image on the layout is shown or not.  I was hoping to find a 'visible' property for IPictureElement that I could turn on & off, but I couldn't find one.  Instead, I've been trying to send it behind or in front of the data frame, but I can't get that to work either.

Here's my current code for this.  When I run it, I get "Compile error: Method or data member not found" and it highlights the pPElement variable in the pGraphics.SendToBack or .BringToFront line.

Dim pGraphics As IGraphicsContainer
Set pGraphics = pMxDoc.PageLayout
pGraphics.Reset

Dim pElementProp As IElementProperties2
Set pElementProp = pGraphics.Next
Dim pPElement As IPictureElement3
Set pPElement = pElementProp

If frmStates.chkLogo.Value = False Then
    MsgBox ("chklogo = false")
   pGraphics.SendToBack (pPElement)
ElseIf frmStates.chkLogo.Value = True Then
    MsgBox ("chklogo = true")
    pGraphics.BringToFront (pPElement)
End If

Outcomes