Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel: Use pic location string to call up picuture in cell? | Excel Discussion (Misc queries) | |||
Marco | Excel Discussion (Misc queries) | |||
Marco Help | Excel Discussion (Misc queries) | |||
I need some help with a Marco | Excel Discussion (Misc queries) | |||
marco | Excel Programming |