View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Linking pictures/logo in excel

Maybe you could put all the logos on a separate worksheet. Then hide that
sheet.

Give the user a macro that would allow them to copy their logo to each of the
worksheets in that workbook.

I created a worksheet named Pictures. I dropped a few pictures in that sheet,
then hid that sheet.

I created a worksheet named Index and added a combobox and a commandbutton (both
from the control toolbox toolbar).

I rightclicked on the Index worksheet tab and selected view code and pasted this
in:

Option Explicit
Dim blkProc As Boolean
Private Sub ComboBox1_Change()

Dim mySheetNames As Variant
Dim myPict As Picture
Dim wks As Worksheet
Dim myAddr As String
Dim LogoName As String

If blkProc = True Then Exit Sub

If Me.ComboBox1.ListIndex = -1 Then Exit Sub

mySheetNames = Array("Sheet2", "sheet3", "sheet5")
myAddr = "A1:B3"
LogoName = "SchoolLogo"

Set myPict = Nothing
On Error Resume Next
Set myPict = Me.Parent.Worksheets("Pictures") _
.Pictures(Me.ComboBox1.Value)
On Error GoTo 0
If myPict Is Nothing Then
MsgBox "Please refresh and try again." & vbLf & _
"Contact xxxx at #### if it fails a second time!"
Exit Sub
End If

Application.ScreenUpdating = False

For Each wks In Me.Parent.Worksheets(mySheetNames)
On Error Resume Next
wks.Pictures(LogoName).Delete
On Error GoTo 0

myPict.Copy
wks.Paste

wks.Select
ActiveCell.Activate

Set myPict = wks.Pictures(wks.Pictures.Count) 'the one just added

With wks.Range(myAddr)
myPict.Top = .Top
myPict.Width = .Width
myPict.Height = .Height
myPict.Left = .Left
End With

myPict.Name = LogoName

Next wks

Me.Select

End Sub

Private Sub CommandButton1_Click()
Dim myPict As Picture
With Me.ComboBox1
blkProc = True
.Clear
blkProc = False
For Each myPict In Me.Parent.Worksheets("Pictures").Pictures
.AddItem myPict.Name
Next myPict
End With
End Sub

Change this:
Array("Sheet2", "sheet3", "sheet5")
to the sheetnames that should get the logo.






smallschoolie wrote:

I have developed a number of spreadsheets in Excel 2003 that I will be
sharing with schools. I want each school to be able to insert their own
school logo so that it appears on each sheet. I have a menu page and was
looking for a way to insert a logo on that page and then paste link it or
some similar method.


--

Dave Peterson