#1   Report Post  
Smitty
 
Posts: n/a
Default linking photos

Oddly enough I was going to just post a question about bringing in a new
picture depending on what doc I was in, and lo-n-behold, the answer may be
very similar to Joe Williams.

I'll make this very generic. :-) I have one multi-sheet Excel file with a
picture on the top of each page. We'll say each report is about one cow.
This report will be duped with new numbers for 20 different cows. Now I
would like the picture of the cow on the top of each page to change depending
on what cow we're reporting on. So if report #1 is about cow #1, I want to
be able to tell the report to update each picture to that of cow #1. After
it updates, it needs to break any links that it established (don't know if it
would, but I can't send it to the client with it trying to update anything).
Then I move on to report #2 about cow #2, and it updates to the picture of
cow #2.

Does that make sense? If not let me know and I'll try it again. Thanks
very much!!

Excel 2002
  #2   Report Post  
Ed Ferrero
 
Posts: n/a
Default

HI Smitty,

You can use the method described in my earlier reply to Joe William.

Assume that 'cow#1', 'cow#2' etc are in cell A1 of each sheet.
Assume cell A2 contains the path for each picture.

This code will create a blank chart on each sheet in a workbook, and
import a picture into the chart based on the contents of cell A1 and A2.

The pictures are not linked, so it is safe to send the resulting workbook
to a client.

The code has been modified slightly to make it more generic. You need
to run the macro 'SetPicsForAllSheets' once to set the pictures for
all worksheets.

Sub SetPicsForAllSheets()
Dim sh As Worksheet
Dim strPic As String
Dim strPth As String
Dim strExt As String

For Each sh In ActiveWorkbook.Worksheets
strPic = sh.Range("A1") ' name of picture to import e.g. cow#1
strPth = sh.Range("A2") ' path of picture e.g. C:\My Documents\
strExt = sh.Range("A3") ' file extension for picture e.g. .jpg, .gif

Call BuildChartPic(sh.Name, strPic, strPth, strExt)
Next sh
End Sub


Sub BuildChartPic(strSht As String, strPic As String, strPth As String,
strExt As String)
Dim ch As ChartObject
' build full path and file name
strPic = strPth & strPic & strExt

Set ch = Worksheets(strSht).ChartObjects.Add(100, 30, 400, 250)

ch.Activate
ActiveChart.ChartArea.Fill.UserPicture PictureFile:=strPic

End Sub

Ed Ferrero
http://edferrero.m6.net

Oddly enough I was going to just post a question about bringing in a new
picture depending on what doc I was in, and lo-n-behold, the answer may be
very similar to Joe Williams.

I'll make this very generic. :-) I have one multi-sheet Excel file with
a
picture on the top of each page. We'll say each report is about one cow.
This report will be duped with new numbers for 20 different cows. Now I
would like the picture of the cow on the top of each page to change
depending
on what cow we're reporting on. So if report #1 is about cow #1, I want
to
be able to tell the report to update each picture to that of cow #1.
After
it updates, it needs to break any links that it established (don't know if
it
would, but I can't send it to the client with it trying to update
anything).
Then I move on to report #2 about cow #2, and it updates to the picture of
cow #2.

Does that make sense? If not let me know and I'll try it again. Thanks
very much!!

Excel 2002



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Photos into Excel and linking to Word. Uploading Photos Excel Discussion (Misc queries) 0 March 17th 05 08:05 PM
Linking worksheets after runnning report Steve Excel Discussion (Misc queries) 0 February 28th 05 09:21 PM
Have to use cursor keys cannot use mouse in excel when linking fo. LUFC Excel Worksheet Functions 0 January 31st 05 09:51 AM
Linking Workbooks Dede McEachern Excel Worksheet Functions 0 January 21st 05 08:27 PM
partial photos in Excel cells Lewis Shanks Setting up and Configuration of Excel 0 January 1st 05 09:00 PM


All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"