CFanatic

Go Back   CFanatic > Programming > C# Programming

Join CFanatic Forum Now

opening an exel file in a c# program topic posted under C# Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 08-31-2010, 04:11 AM
 
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
arian is on a distinguished road
| More
opening an exel file in a c# program

Hi

I am getting the following error while opening the exel file. I am sure the path and the file name is correct.

'G:\myCodeProgram\swiming\beforeMatch\Files\Input\ arrange.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct.

If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted.

System.Runtime.InteropServices.COMException was unhandled
HelpLink="C:\\Program Files (x86)\\Microsoft Office\\Office12\\1033\\XLMAIN11.CHM"
Message="'G:\\myCodeProgram\\swiming\\beforeMatch\ \Files\\Input\arrange.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct.\n\nIf you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted."
Source="Microsoft Office Excel"
ErrorCode=-2146827284
StackTrace:
at Microsoft.Office.Interop.Excel.Workbooks.Open(Stri ng Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at matchProvider.mainInfo.button1_Click(Object sender, EventArgs e) in G:\myCodeProgram\swiming\beforeMatch\1\matchProvid er\matchProvider\mainInfo.cs:line 116
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at matchProvider.Program.Main() in G:\myCodeProgram\swiming\beforeMatch\1\matchProvid er\matchProvider\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
I use visual Studio 2008 , win7 (86X)

and here is the code
Code:
 	object opt = System.Reflection.Missing.Value;
                Excel.Application excel = new Excel.ApplicationClass();
                Excel.Sheets Sheets;
                Excel.Workbook wArrange;

                wArrange = excel.Workbooks.Open(path+"\arrange.xlsx", opt, false, opt, opt, opt, true, opt, opt, opt, opt, opt, opt, opt, opt);
                Sheets = wArrange.Worksheets;
                teamNum = wArrange.Sheets.Count;

                wArrange.Close(true, opt, opt);
Can you plz tell me what is wrong?

Tnx
arian
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Immediate opening for C Programmer abhi4537 Looking to hire 6 02-01-2011 02:51 PM
How to bypass security check while opening a file? unmeshjoshi Win32 Programming 2 03-18-2010 11:23 PM
Opening post here. Neexattescero Introduce yourself 3 02-21-2010 08:55 PM
Ho to all (opening for c programmer) abhi4537 Introduce yourself 1 02-17-2009 05:23 AM
Getting a C# program with a manifest file to run in the debugger Xarzu C# Programming 2 01-21-2008 03:04 PM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 04:20 PM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board