Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 16, 2012 10:04 AM by bbcompent1
Nov 15, 2012 03:07 AM|LINK
Losing some sleep on this.
i have an excel template which i copy then try to open (thsi is all within a dll within my website).
the file copies and exists (with a system.io.file.exists)
however when i attempt the file open with excel it fails
command i'm using is:
xlsWorkBook = XLS.Workbooks.Open(strFilename, , False)
the error is:Microsoft Office Excel cannot access the file 'abcd.xlsm'. There are several possible reasons: The file name or path does not exist. The file is being used by another program. he workbook you are trying to save has the same name as a currently open workbook.I'm confused as firstly the code works locally no problems and secondly the file exists.so i'm not sure if its becaue the file is located outside of the website space (in some other folder).any help appreciated.
Nov 15, 2012 01:06 PM|LINK
Best practices dictate that this file should exist inside the web folder otherwise you will have to do hard coded paths which can cause problems if you move the site. I'd suggest putting the file in a folder under the web site.
Nov 15, 2012 10:12 PM|LINK
yes i thought the same - the file is within the web app directory but i'm accessing via disk paths
is this likely to caues a problem?
or how would i path an open file from within a dll to a web directory?
Nov 16, 2012 10:04 AM|LINK
Well, if you have it on the web server path, you can use
Server.MapPath method and that should get around this problem.