Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Inserting a Picture from Folder over cell in 2007


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Inserting a Picture from Folder over cell in 2007

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Inserting a Picture from Folder over cell in 2007

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Inserting a Picture from Folder over cell in 2007

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Inserting a Picture from Folder over cell in 2007

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Inserting a Picture from Folder over cell in 2007

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
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 a picture from file into a cell The Message Excel Discussion (Misc queries) 1 July 20th 09 02:47 PM
Inserting a picture into a cell The Message Excel Discussion (Misc queries) 0 July 20th 09 12:50 PM
Inserting a Picture using Cell as picture name. the-jackal Links and Linking in Excel 12 November 10th 08 09:21 AM
Inserting a picture or chart into one cell in Excel Clandestine Excel Worksheet Functions 1 January 25th 08 07:35 PM
inserting a picture into a cell Rosa B. Excel Discussion (Misc queries) 1 December 7th 05 09:42 PM


All times are GMT +1. The time now is 12:13 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"