Logo Help

O

Oggy

Hi

I have the following code to insert a logo into a spreadsheet. This is
anyone of three a user will choose from.

My problem is i want a macro to toggle the visibility of the logo on
or off. I have not been able name the logo to then turn it off.

Have i gone about this the wrong way?

Any code pointing me in the right direction would be much appreciated.

Sub logo()
'insert the logo

Dim logo As Picture
With Range("f1")
Set logo = .Parent.Pictures.Insert("H:\Administration
\logo1.bmp")
logo.Top = .Top
logo.Left = .Left
End With
End Sub


Sub logotoggle()

if logo.Visible = False then logo.Visible = true
else
logo.Visible = False
end if

end sub
 
K

Ken Johnson

Hi

I have the following code to insert a logo into a spreadsheet. This is
anyone of three a user will choose from.

My problem is i want a macro to toggle the visibility of the logo on
or off. I have not been able name the logo to then turn it off.

Have i gone about this the wrong way?

Any code pointing me in the right direction would be much appreciated.

Sub logo()
'insert the logo

Dim logo As Picture
With Range("f1")
Set logo = .Parent.Pictures.Insert("H:\Administration
\logo1.bmp")
logo.Top = .Top
logo.Left = .Left
End With
End Sub

Sub logotoggle()

if logo.Visible = False then logo.Visible = true
else
logo.Visible = False
end if

end sub

I got "Ambiguous Name" error so I changed Picture variable name to
logo1
The logo1 variable needed to be declared as Public in the Declaration
section of the module (above the first Sub).
I also simplified the toggle code.

Public logo1 As Picture
Sub logo()
'insert the logo
With Range("f1")
Set logo1 = .Parent.Pictures.Insert("H:\Administration
\logo1.bmp")
logo1.Top = .Top
logo1.Left = .Left
End With
End Sub

Sub logotoggle()

logo1.Visible = Not logo1.Visible

End Sub

Ken Johnson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top