![]() |
Change Picture
After using the 2007 ribbon menus to insert a picture on my sheet, I can
right click the picture and get an option to "change picture". But macro recorder doesn't capture this, and I've had a hard time finding the answer in the object model reference. What is the code equivalent of "change picture"? Please and thanks! |
Change Picture
On May 13, 12:59*am, B Lynn B
wrote: After using the 2007 ribbon menus to insert a picture on my sheet, I can right click the picture and get an option to "change picture". *But macro recorder doesn't capture this, and I've had a hard time finding the answer in the object model reference. *What is the code equivalent of "change picture"? *Please and thanks! You can use following: Worksheets("Sheetname").Pictures.Insert "Filename" Don't ask me why the pictures object not in Object model of Sheet object.Ask MS. |
Change Picture
Thanks Javed. Appreciate the effort to help. The code below adds a new
picture, so there are then two. I already have it solved that way - while first deleting the one already there. I was hoping to change the image of an existing picture. And I agree, as I looked for a way to "speak" to the existing picture object, I had a hard time believing it simply didn't exist in the object model. "Javed" wrote: On May 13, 12:59 am, B Lynn B wrote: After using the 2007 ribbon menus to insert a picture on my sheet, I can right click the picture and get an option to "change picture". But macro recorder doesn't capture this, and I've had a hard time finding the answer in the object model reference. What is the code equivalent of "change picture"? Please and thanks! You can use following: Worksheets("Sheetname").Pictures.Insert "Filename" Don't ask me why the pictures object not in Object model of Sheet object.Ask MS. . |
Change Picture
I had a hard time believing it simply didn't exist in the object
model. Me too! As you say the only way appears to insert a new picture. What you could do is start by extracting all the properties from the original Picture, in particular it's dimensions, order-position and name. Insert the new picture then assign all similar properties including its name (after deleting the original picture of course). Regards, Peter T "B Lynn B" wrote in message ... Thanks Javed. Appreciate the effort to help. The code below adds a new picture, so there are then two. I already have it solved that way - while first deleting the one already there. I was hoping to change the image of an existing picture. And I agree, as I looked for a way to "speak" to the existing picture object, I had a hard time believing it simply didn't exist in the object model. "Javed" wrote: On May 13, 12:59 am, B Lynn B wrote: After using the 2007 ribbon menus to insert a picture on my sheet, I can right click the picture and get an option to "change picture". But macro recorder doesn't capture this, and I've had a hard time finding the answer in the object model reference. What is the code equivalent of "change picture"? Please and thanks! You can use following: Worksheets("Sheetname").Pictures.Insert "Filename" Don't ask me why the pictures object not in Object model of Sheet object.Ask MS. . |
Change Picture
Thanks Peter - it's helpful just to have confirmation that I should stop
looking for the answer and chalk it up to application builders' oversight. I can live with that more easily than fretting over the possibility I've just failed to find the right solution. :) "Peter T" wrote: I had a hard time believing it simply didn't exist in the object model. Me too! As you say the only way appears to insert a new picture. What you could do is start by extracting all the properties from the original Picture, in particular it's dimensions, order-position and name. Insert the new picture then assign all similar properties including its name (after deleting the original picture of course). Regards, Peter T "B Lynn B" wrote in message ... Thanks Javed. Appreciate the effort to help. The code below adds a new picture, so there are then two. I already have it solved that way - while first deleting the one already there. I was hoping to change the image of an existing picture. And I agree, as I looked for a way to "speak" to the existing picture object, I had a hard time believing it simply didn't exist in the object model. "Javed" wrote: On May 13, 12:59 am, B Lynn B wrote: After using the 2007 ribbon menus to insert a picture on my sheet, I can right click the picture and get an option to "change picture". But macro recorder doesn't capture this, and I've had a hard time finding the answer in the object model reference. What is the code equivalent of "change picture"? Please and thanks! You can use following: Worksheets("Sheetname").Pictures.Insert "Filename" Don't ask me why the pictures object not in Object model of Sheet object.Ask MS. . . |
All times are GMT +1. The time now is 09:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com