inserting pictures
Yeah....
But I think you'll have to explain more about what you really mean.
Do you want a picture (like a logo) added to E1:G2 for each worksheet?
Or maybe you want a picuture added to each worksheet that is always in the same
position--but maybe not over the same cells?
If over the same cells:
Option Explicit
Sub testme02()
Dim myPictureName As Variant
Dim myPict As Picture
Dim myRng As Range
Dim myAddr As String
Dim wks As Worksheet
myPictureName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")
If myPictureName = False Then
Exit Sub 'user hit cancel
End If
myAddr = "e1:g2"
For Each wks In ActiveWorkbook.Worksheets
Set myRng = wks.Range(myAddr)
Set myPict = wks.Pictures.Insert(myPictureName)
myPict.Top = myRng.Top
myPict.Width = myRng.Width
myPict.Height = myRng.Height
myPict.Left = myRng.Left
myPict.Placement = xlMoveAndSize
Next wks
End Sub
If in the same position (maybe not over the same cells):
Option Explicit
Sub testme02()
Dim myPictureName As Variant
Dim myPict As Picture
Dim myRng As Range
Dim wks As Worksheet
myPictureName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")
If myPictureName = False Then
Exit Sub 'user hit cancel
End If
With Worksheets("sheet1")
Set myRng = .Range("c3:e5")
End With
For Each wks In ActiveWorkbook.Worksheets
Set myPict = wks.Pictures.Insert(myPictureName)
myPict.Top = myRng.Top
myPict.Width = myRng.Width
myPict.Height = myRng.Height
myPict.Left = myRng.Left
myPict.Placement = xlMoveAndSize
Next wks
End Sub
Denny wrote:
Is it possible to insert pictures into each sheet of a workbook that will
have the same size and be in the same location each time? TIA!
--
Dave Peterson
|