Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inserting picture into excel based on # in the another cell | Excel Worksheet Functions | |||
visual basic | Excel Worksheet Functions | |||
Visual Basic and SP2 | Excel Discussion (Misc queries) | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Visual Basic Help | Excel Discussion (Misc queries) |