LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Are there any NON-Visual Basic solutions for inserting a picture based a derived or called filename?

On Sat, 26 May 2007 21:12:34 -0400, "Bernie Deitrick" <deitbe @ consumer
dot org wrote:

Jack,

Something like this, where you delete the picture first: note the name
"PictureD10".


Yes. The code works perfectly. I renamed the sub "Pop", and the
picture name "Popped", but everything else remains the same.

I think I can do the one remaining function I seek, which is to scale
the picture to fit my area. This way, I don't have to scale them by hand
as I add them to my image archive.


Thank you for all of your help.

You Da Man!

You need to change the InsertPicture sub that you are using
as below, to name the picture when it is inserted, and change how you call
the function.

Sub InsertPic()
On Error Resume Next
ActiveSheet.Shapes("PictureD10").Delete
InsertPicture Range("H7").Value, _
Range("D10"), True, True, "PictureD10"
End Sub

Sub InsertPicture(PictureFileName As String, TargetCell As Range, _
CenterH As Boolean, CenterV As Boolean, picName As String)
' inserts a picture at the top left position of TargetCell
' the picture can be centered horizontally and/or vertically
Dim p As Object, t As Double, l As Double, w As Double, h As Double
If TypeName(ActiveSheet) < "Worksheet" Then Exit Sub
If Dir(PictureFileName) = "" Then Exit Sub
' import picture
Set p = ActiveSheet.Pictures.Insert(PictureFileName)
'Name the picture so you can delete it later....
p.Name = picName
' determine positions
'then the rest of your code here....


HTH,
Bernie
MS Excel MVP




"JackShepherd" wrote in
message ...
On Sat, 26 May 2007 08:58:49 -0400, "Bernie Deitrick" <deitbe @ consumer
dot org wrote:

It depends on what is in cell H7.


Full path and name with extension:
InsertPicture Range("H7").Value, _
Range("D10"), True, True

HTH,
Bernie
MS Excel MVP



OK, that worked, except I had to go through and remove the quotes from
all the cell contents. (Thank You, btw).

Now, I need a routine that will clear the picture from that cell,
("D10"), but not other pictures in the sheet, just before running the
picture popup code, so that they don't simply stack up on top of each
other, as they do now. Clearing the cell contents fails as it leaves the
picture untouched. There are three other pictures in the sheet... I
wonder if simply clearing "Picture 4" will work.


 
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 picture into excel based on # in the another cell jstaggs Excel Worksheet Functions 2 December 14th 06 06:55 PM
visual basic jiwolf Excel Worksheet Functions 2 October 8th 05 09:12 PM
Visual Basic and SP2 JessJ Excel Discussion (Misc queries) 2 October 6th 05 12:17 PM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM
Visual Basic Help Duncan Smith Excel Discussion (Misc queries) 1 December 3rd 04 09:13 AM


All times are GMT +1. The time now is 08:40 AM.

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

About Us

"It's about Microsoft Excel"