Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Marco for Picuture

I am trying to create a macro in a cell that will insert a picture within the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Marco for Picuture

Turn on the macro recorder and perform the action manually. Then you will
get code that allows you to insert a picture.

I recorded a macro like this:
Range("B9").Select
ActiveSheet.Pictures.Insert( _
"C:\My Pictures\Sample.jpg"). _
Select

You could add
Selection.Height = Range("B9").Height
Selection.Width = Range("B9").width

--
Regards,
Tom Ogilvy


"Daniel R. Young" wrote in message
...
I am trying to create a macro in a cell that will insert a picture within

the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Marco for Picuture

Hi Daniel

You can use this to insert a picture and make it the same size as the cell

Sub test()
Dim YourPicture As Picture
With ActiveSheet.Range("D1")
Set YourPicture = .Parent.Pictures.Insert("C:\picture1.bmp")
YourPicture.Top = .Top
YourPicture.Width = .Width
YourPicture.Height = .Height
YourPicture.Left = .Left
YourPicture.Placement = xlMoveAndSize
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Daniel R. Young" wrote in message
...
I am trying to create a macro in a cell that will insert a picture within the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Marco for Picuture

Good opportunity to jump in with a related problem Ron ... Can the below be
expanded as follows: suppose had a list of image URLs to loop through, and
each of these I want to save the target to HD. Example:
http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif

and I want to actually create a new file on my HD with this picture, can it
be done? I tried using OLEObject and coundn't get anywhere.

Thanks



"Ron de Bruin" wrote in message
...
Hi Daniel

You can use this to insert a picture and make it the same size as the cell

Sub test()
Dim YourPicture As Picture
With ActiveSheet.Range("D1")
Set YourPicture = .Parent.Pictures.Insert("C:\picture1.bmp")
YourPicture.Top = .Top
YourPicture.Width = .Width
YourPicture.Height = .Height
YourPicture.Left = .Left
YourPicture.Placement = xlMoveAndSize
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Daniel R. Young" wrote in
message ...
I am trying to create a macro in a cell that will insert a picture within
the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Marco for Picuture

Hi William

Try this

With the list of urls in column A of "Sheet1"
in will insert the picture in a new workbook and save the file as Picture ?


Sub Add_Pictures_from_Website()
Dim wb As Workbook
Dim cell As Range
Dim a As Long
a = 0
For Each cell In Sheets("Sheet1").Columns("A").Cells.SpecialCells(x lCellTypeConstants)
If cell.Value Like "http://*" Then
a = a + 1
Set wb = Workbooks.Add(xlWBATWorksheet)

wb.Sheets(1).Shapes.AddPicture cell.Value, msoTrue, _
msoFalse, 100, 100, 100, 50
wb.SaveAs "Picture " & a & ".xls"
wb.Close False
End If
Next cell
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"William Benson" wrote in message ...
Good opportunity to jump in with a related problem Ron ... Can the below be expanded as follows: suppose had a list of image URLs
to loop through, and each of these I want to save the target to HD. Example: http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif

and I want to actually create a new file on my HD with this picture, can it be done? I tried using OLEObject and coundn't get
anywhere.

Thanks



"Ron de Bruin" wrote in message ...
Hi Daniel

You can use this to insert a picture and make it the same size as the cell

Sub test()
Dim YourPicture As Picture
With ActiveSheet.Range("D1")
Set YourPicture = .Parent.Pictures.Insert("C:\picture1.bmp")
YourPicture.Top = .Top
YourPicture.Width = .Width
YourPicture.Height = .Height
YourPicture.Left = .Left
YourPicture.Placement = xlMoveAndSize
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Daniel R. Young" wrote in message
...
I am trying to create a macro in a cell that will insert a picture within the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Marco for Picuture

I tried that, I guess I neede something a little different because I want
the result to be the same type file the ImageURL was? I am trying to use
Excel as a mechanism to save the pictures which the imageURLs point to on my
h.d. (depending on URL file, it could be gif, could be jpg, etc) Thanks.


"Ron de Bruin" wrote in message
...
Hi William

Try this

With the list of urls in column A of "Sheet1"
in will insert the picture in a new workbook and save the file as Picture
?


Sub Add_Pictures_from_Website()
Dim wb As Workbook
Dim cell As Range
Dim a As Long
a = 0
For Each cell In
Sheets("Sheet1").Columns("A").Cells.SpecialCells(x lCellTypeConstants)
If cell.Value Like "http://*" Then
a = a + 1
Set wb = Workbooks.Add(xlWBATWorksheet)

wb.Sheets(1).Shapes.AddPicture cell.Value, msoTrue, _
msoFalse, 100, 100, 100, 50
wb.SaveAs "Picture " & a & ".xls"
wb.Close False
End If
Next cell
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"William Benson" wrote in message
...
Good opportunity to jump in with a related problem Ron ... Can the below
be expanded as follows: suppose had a list of image URLs to loop through,
and each of these I want to save the target to HD. Example:
http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif

and I want to actually create a new file on my HD with this picture, can
it be done? I tried using OLEObject and coundn't get anywhere.

Thanks



"Ron de Bruin" wrote in message
...
Hi Daniel

You can use this to insert a picture and make it the same size as the
cell

Sub test()
Dim YourPicture As Picture
With ActiveSheet.Range("D1")
Set YourPicture = .Parent.Pictures.Insert("C:\picture1.bmp")
YourPicture.Top = .Top
YourPicture.Width = .Width
YourPicture.Height = .Height
YourPicture.Left = .Left
YourPicture.Placement = xlMoveAndSize
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Daniel R. Young" wrote in
message ...
I am trying to create a macro in a cell that will insert a picture
within the
cell specifically formatted to that cell so it will not be gigantic
when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Marco for Picuture

and I want to actually create a new file on my HD with this picture

This example will add a workbook with the picture ?
Do you want to save only the pictures ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"William Benson" wrote in message ...
I tried that, I guess I neede something a little different because I want the result to be the same type file the ImageURL was? I
am trying to use Excel as a mechanism to save the pictures which the imageURLs point to on my h.d. (depending on URL file, it could
be gif, could be jpg, etc) Thanks.


"Ron de Bruin" wrote in message ...
Hi William

Try this

With the list of urls in column A of "Sheet1"
in will insert the picture in a new workbook and save the file as Picture ?


Sub Add_Pictures_from_Website()
Dim wb As Workbook
Dim cell As Range
Dim a As Long
a = 0
For Each cell In Sheets("Sheet1").Columns("A").Cells.SpecialCells(x lCellTypeConstants)
If cell.Value Like "http://*" Then
a = a + 1
Set wb = Workbooks.Add(xlWBATWorksheet)

wb.Sheets(1).Shapes.AddPicture cell.Value, msoTrue, _
msoFalse, 100, 100, 100, 50
wb.SaveAs "Picture " & a & ".xls"
wb.Close False
End If
Next cell
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"William Benson" wrote in message ...
Good opportunity to jump in with a related problem Ron ... Can the below be expanded as follows: suppose had a list of image
URLs to loop through, and each of these I want to save the target to HD. Example:
http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif

and I want to actually create a new file on my HD with this picture, can it be done? I tried using OLEObject and coundn't get
anywhere.

Thanks



"Ron de Bruin" wrote in message ...
Hi Daniel

You can use this to insert a picture and make it the same size as the cell

Sub test()
Dim YourPicture As Picture
With ActiveSheet.Range("D1")
Set YourPicture = .Parent.Pictures.Insert("C:\picture1.bmp")
YourPicture.Top = .Top
YourPicture.Width = .Width
YourPicture.Height = .Height
YourPicture.Left = .Left
YourPicture.Placement = xlMoveAndSize
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Daniel R. Young" wrote in message
...
I am trying to create a macro in a cell that will insert a picture within the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Marco for Picuture

Thought I did that, sorry - re-posted...

Bill


"Ron de Bruin" wrote in message
...
Hi Daniel

You can use this to insert a picture and make it the same size as the cell

Sub test()
Dim YourPicture As Picture
With ActiveSheet.Range("D1")
Set YourPicture = .Parent.Pictures.Insert("C:\picture1.bmp")
YourPicture.Top = .Top
YourPicture.Width = .Width
YourPicture.Height = .Height
YourPicture.Left = .Left
YourPicture.Placement = xlMoveAndSize
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Daniel R. Young" wrote in
message ...
I am trying to create a macro in a cell that will insert a picture within
the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Marco for Picuture

Hi Dan,

You may wish to look at how JE McGimpsey handles the conditional display of
picture in a worksheet:

http://www.mcgimpsey.com/excel/lookuppics.html


I am trying to create a macro in a cell that will insert a picture within
the
cell specifically formatted to that cell so it will not be gigantic when
selected.


A picture has a Height and a Width property and you can set the to equal a
worksheet cell's Height and Width properties.


---
Regards,
Norman



"Daniel R. Young" wrote in message
...
I am trying to create a macro in a cell that will insert a picture within
the
cell specifically formatted to that cell so it will not be gigantic when
selected.

I started with this:
Private Sub Macro()

msoCommandBarButtonHyperlinkInsertPicture = (A83)

End Sub

Can someone help?

thank you,
Dan



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
Excel: Use pic location string to call up picuture in cell? vloh28 Excel Discussion (Misc queries) 1 October 30th 07 12:42 AM
Marco Puzzled Excel Discussion (Misc queries) 3 July 30th 07 05:09 PM
Marco Help looper Excel Discussion (Misc queries) 2 May 12th 07 06:55 PM
I need some help with a Marco xgunda420x Excel Discussion (Misc queries) 2 August 2nd 05 01:43 PM
marco David Kuehl Excel Programming 4 September 18th 03 11:37 PM


All times are GMT +1. The time now is 04:02 PM.

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"