VB.net Excel Add-in Insert an imagef from project resources

Hi
I am ableto add an image to my Excel spreadsheet usingthe following line of VB.net code
myPict = xlApp.Cells(9, 9).Parent.Pictures.Insert("C:\Users\Murray\Pictures\Automator\AutoFill.png")
I now want to add an image from my resoures using the following line I get the error "Unable to get the Insert property at the pictures class"
myPict = xlApp.Cells(9, 9).Parent.Pictures.Insert(My.Resources.ResourceManager.GetObject(oImageName))
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
Maybe this will help.

' Visual Basic .NET
' Gets a reference to the same assembly that 
' contains the type that is creating the ResourceManager.
Dim myAssembly As System.Reflection.Assembly
myAssembly = Me.GetType.Assembly

' Gets a reference to a different assembly.
Dim myOtherAssembly As System.Reflection.Assembly
myOtherAssembly = System.Reflection.Assembly.Load("ResourceAssembly")

' Creates the ResourceManager.
Dim myManager As New _
   System.Resources.ResourceManager("ResourceNamespace.myResources", _
   myAssembly)

Dim myString As System.String
Dim myImage As System.Drawing.Image
myString = myManager.GetString("StringResource")
myImage = CType(myManager.GetObject("ImageResource"), _
    System.Drawing.Image)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.