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
Ken Johnson - 09 Apr 2008 00:10 GMT
> Hi
>
[quoted text clipped - 28 lines]
>
> 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