ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Accessing pasted pictures (https://www.excelbanter.com/excel-programming/374955-accessing-pasted-pictures.html)

Abhimanyu Sirohi

Accessing pasted pictures
 
I am creating a Shared Add-In in Visual Studio 2005 using Interop assemblies
for Office XP. (v10).
I want to put pictures in cells, so I copied them to the clipboard and
pasted on a range (single cell). Now, Is there anyway I can access these
pasted pictures. Excel names them "Picture 1", "Picture 2" and so on. Even if
I rename "Picture 1", the newly pasted picture is "Picture 2".
Also, Is there a way to avoid copying to the clipboard and then pasting the
picture. Any direct method to insert a picture in worksheet (I have an Image
object not a filename, so Shapes.AddPicture won;t work).

regards


John[_122_]

Accessing pasted pictures
 
The pictures will be members of the shapes collection, so you could
access them that way.
Somethign like:

Sub mypics()
Dim myObj As Object

For Each myObj In ActiveSheet.Shapes
If myObj.Type = msoPicture Then
MsgBox myObj.Name
End If
Next myObj
End Sub



Abhimanyu Sirohi wrote:
I am creating a Shared Add-In in Visual Studio 2005 using Interop assemblies
for Office XP. (v10).
I want to put pictures in cells, so I copied them to the clipboard and
pasted on a range (single cell). Now, Is there anyway I can access these
pasted pictures. Excel names them "Picture 1", "Picture 2" and so on. Even if
I rename "Picture 1", the newly pasted picture is "Picture 2".
Also, Is there a way to avoid copying to the clipboard and then pasting the
picture. Any direct method to insert a picture in worksheet (I have an Image
object not a filename, so Shapes.AddPicture won;t work).

regards



Abhimanyu Sirohi

Accessing pasted pictures
 
Hi,
But how do I get the name of picture I've just pasted. This iteration will
return all the pictures. I need the one I've pasted right now.

thanks


"John" wrote:

The pictures will be members of the shapes collection, so you could
access them that way.
Somethign like:

Sub mypics()
Dim myObj As Object

For Each myObj In ActiveSheet.Shapes
If myObj.Type = msoPicture Then
MsgBox myObj.Name
End If
Next myObj
End Sub



Abhimanyu Sirohi wrote:
I am creating a Shared Add-In in Visual Studio 2005 using Interop assemblies
for Office XP. (v10).
I want to put pictures in cells, so I copied them to the clipboard and
pasted on a range (single cell). Now, Is there anyway I can access these
pasted pictures. Excel names them "Picture 1", "Picture 2" and so on. Even if
I rename "Picture 1", the newly pasted picture is "Picture 2".
Also, Is there a way to avoid copying to the clipboard and then pasting the
picture. Any direct method to insert a picture in worksheet (I have an Image
object not a filename, so Shapes.AddPicture won;t work).

regards




Abhimanyu Sirohi

Accessing pasted pictures
 
Hi,
But how do I get the name of picture I've just pasted. This iteration will
return all the pictures. I need the one I've pasted right now.

thanks


"John" wrote:

The pictures will be members of the shapes collection, so you could
access them that way.
Somethign like:

Sub mypics()
Dim myObj As Object

For Each myObj In ActiveSheet.Shapes
If myObj.Type = msoPicture Then
MsgBox myObj.Name
End If
Next myObj
End Sub



Abhimanyu Sirohi wrote:
I am creating a Shared Add-In in Visual Studio 2005 using Interop assemblies
for Office XP. (v10).
I want to put pictures in cells, so I copied them to the clipboard and
pasted on a range (single cell). Now, Is there anyway I can access these
pasted pictures. Excel names them "Picture 1", "Picture 2" and so on. Even if
I rename "Picture 1", the newly pasted picture is "Picture 2".
Also, Is there a way to avoid copying to the clipboard and then pasting the
picture. Any direct method to insert a picture in worksheet (I have an Image
object not a filename, so Shapes.AddPicture won;t work).

regards




Abhimanyu Sirohi

Accessing pasted pictures
 
Hi,
But how do I get the name of picture I've just pasted. This iteration will
return all the pictures. I need the one I've pasted right now.

thanks


"John" wrote:

The pictures will be members of the shapes collection, so you could
access them that way.
Somethign like:

Sub mypics()
Dim myObj As Object

For Each myObj In ActiveSheet.Shapes
If myObj.Type = msoPicture Then
MsgBox myObj.Name
End If
Next myObj
End Sub



Abhimanyu Sirohi wrote:
I am creating a Shared Add-In in Visual Studio 2005 using Interop assemblies
for Office XP. (v10).
I want to put pictures in cells, so I copied them to the clipboard and
pasted on a range (single cell). Now, Is there anyway I can access these
pasted pictures. Excel names them "Picture 1", "Picture 2" and so on. Even if
I rename "Picture 1", the newly pasted picture is "Picture 2".
Also, Is there a way to avoid copying to the clipboard and then pasting the
picture. Any direct method to insert a picture in worksheet (I have an Image
object not a filename, so Shapes.AddPicture won;t work).

regards





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com