Copy Resource File to Directory - VSTO - VB.NET

12 Views Asked by At

I want to copy a Bitmap file from the Resources in my VSTO Excel Add-in project to a directory on the end user's hard drive.

I want to copy the MyResourceBitmapFile Bitmap file to the "C:\MyTempDir" directory. I receive the error "Conversion from 'Bitmap' to 'String' is not valid.' I was prepared for this error message because I am aware that the first parameter, sourceFileName, in the Copy function is a string. I present the code to illustrate what I am trying to accomplish.

Any suggestions are welcome.

Dim DirName as String = "C:\MyTempDir"
Dim ResoureFile as System.Drawing.Bitmap
ResourceFile = My.Resources.MyResourceBitmapFile
System.IO.File.Copy(ResourceFile,DirName)
0

There are 0 best solutions below