|
-
Jul 11th, 2012, 12:02 PM
#1
Thread Starter
Junior Member
opening excel file in resources folder
Excuse me, but how do you access a file (in my case excel) that is in the resources folder? I am using interop to access to all of my excel files, any ideas how to access them via the resources folder?
Code:
' what i have:
xlsWorkBook = xlsApp.Workbooks.Open("C:\inventario Programa Julio.xlsx")
'is this right?
xlsWorkBook = xlsApp.Workbooks.Open(Str(My.Resources.acceso))
-
Jul 11th, 2012, 06:31 PM
#2
Re: opening excel file in resources folder
are you adding the actual excel file as a resource, or a string that points to the excel file somewhere else on disk?
If it is that you are adding the whole excel file, then it will be stored as a byte array inside your exe file. When you access it with My.Resources.acceso, you are getting an array of bytes, which you would need to write to disk (perhaps to the users temp folder) and then call workbooks.open() passing in the string path to the file on the drive. Excel is only going to open a file on disk, so you can't get around needing to extract it somewhere on the users drive. Look at My.Computer.FileSystem.WriteAllBytes() method, which would be useful to write the byte array of the file out to a place on the disk so you can open it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|