tags:

views:

46

answers:

2

Hi,

I add an excel file to my project resource, and I would like to open it, but method woorkobook.open() take only path string as parameter :-(

What is the proper way to open and use those excel files from resource?

A: 

in VS, if you set the property "Copy to Output Directory" to "Copy always", on the excel file you've added to your project, you can then directly use the name of your file as the value of the path.

PierrOz
A: 

Office applications are before the time of .NET Streams. The applications only work with physical files. You must copy the resource to a physical file or use a third-party component.

        Dim sPath As String = My.Computer.FileSystem.GetTempFileName
        My.Computer.FileSystem.WriteAllBytes(sPath, My.Resources.us, False)
AMissico
I had to convert to c#, but it works fantastic!Thank you :-)c# converted code: string sPath = System.IO.Path.GetTempFileName();System.IO.File.WriteAllBytes(sPath,Properties.Resources.test);
kuba
@user363289: You are welcome.
AMissico