Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you are looking for this to add the picture on top of C3
Sub test() Dim YourPic As Picture With ActiveSheet.Range("C3") Set YourPic = .Parent.Pictures.Insert("C:\Data\Picture1.jpg") YourPic.Top = .Top YourPic.Width = .Width YourPic.Height = .Height YourPic.Left = .Left End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "ironhydroxide" wrote in message ... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, yesterday the browser was giving me problems and i could not write an
explaination to my subject. I have a loop that updates the Filename everytime it loops and it is different every time. the loop gives me a public declared string of the filename. (the populate is in a different subfunction as the loop.) How do i take this string of the file (i know that the filename will be in the stated folder) and use it for the Address of the picture to be populated. I was successful once, but then I changed some other code (unrelated code) and i couldnt get this snippet to work anymore. Thanks Ironhydroxide "Ron de Bruin" wrote: Maybe you are looking for this to add the picture on top of C3 Sub test() Dim YourPic As Picture With ActiveSheet.Range("C3") Set YourPic = .Parent.Pictures.Insert("C:\Data\Picture1.jpg") YourPic.Top = .Top YourPic.Width = .Width YourPic.Height = .Height YourPic.Left = .Left End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "ironhydroxide" wrote in message ... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you dim the string at the top of the module you can use it in your code
Set YourPic = .Parent.Pictures.Insert(YourVariable) -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "ironhydroxide" wrote in message ... Sorry, yesterday the browser was giving me problems and i could not write an explaination to my subject. I have a loop that updates the Filename everytime it loops and it is different every time. the loop gives me a public declared string of the filename. (the populate is in a different subfunction as the loop.) How do i take this string of the file (i know that the filename will be in the stated folder) and use it for the Address of the picture to be populated. I was successful once, but then I changed some other code (unrelated code) and i couldnt get this snippet to work anymore. Thanks Ironhydroxide "Ron de Bruin" wrote: Maybe you are looking for this to add the picture on top of C3 Sub test() Dim YourPic As Picture With ActiveSheet.Range("C3") Set YourPic = .Parent.Pictures.Insert("C:\Data\Picture1.jpg") YourPic.Top = .Top YourPic.Width = .Width YourPic.Height = .Height YourPic.Left = .Left End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "ironhydroxide" wrote in message ... |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks I had the problem of not using "Set" Before a Dimensioned YourPic So
that is working Now I now have the question of how to position the Picture over the cell that i want. For the most part it is in the correct position but it waviers up and down a bit covering important info beneath it. Here is a Snippit of my code With ActiveSheet.Cells(PopRow, PopCol) Set yourPic = ActiveSheet.Pictures.Insert(Picstring) yourPic.Top = Cells(PopRow, PopCol).Top 'Here i expect the picture to be set alligned with the top of the cell. (apparently it isnt working correctly or i am having a different problem) yourPic.Width = Cells(PopRow, PopCol).Width yourPic.Height = Cells(PopRow, PopCol).Height yourPic.Left = Cells(PopRow, PopCol).Left 'Here i expect the picture to be set alligned with the side of the cell. (this seems to be working perfectly) End With Hopefully you can answer this question also. Ironhydroxide |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
FOUND IT!
I swapped the yourPic.Top = Cells(PopRow, PopCol).Top from the top to the bottom of the set of cell moving/sizing commands. Thanks anyways "ironhydroxide" wrote: Thanks I had the problem of not using "Set" Before a Dimensioned YourPic So that is working Now I now have the question of how to position the Picture over the cell that i want. For the most part it is in the correct position but it waviers up and down a bit covering important info beneath it. Here is a Snippit of my code With ActiveSheet.Cells(PopRow, PopCol) Set yourPic = ActiveSheet.Pictures.Insert(Picstring) yourPic.Top = Cells(PopRow, PopCol).Top 'Here i expect the picture to be set alligned with the top of the cell. (apparently it isnt working correctly or i am having a different problem) yourPic.Width = Cells(PopRow, PopCol).Width yourPic.Height = Cells(PopRow, PopCol).Height yourPic.Left = Cells(PopRow, PopCol).Left 'Here i expect the picture to be set alligned with the side of the cell. (this seems to be working perfectly) End With Hopefully you can answer this question also. Ironhydroxide |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Inserting a picture from file into a cell | Excel Discussion (Misc queries) | |||
Inserting a picture into a cell | Excel Discussion (Misc queries) | |||
Inserting a Picture using Cell as picture name. | Links and Linking in Excel | |||
Inserting a picture or chart into one cell in Excel | Excel Worksheet Functions | |||
inserting a picture into a cell | Excel Discussion (Misc queries) |