Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How should i copy a excel file with a different name in the server any folder?
Posted
Updated 26-Aug-13 6:02am
v2
Comments
Richard C Bishop 26-Aug-13 12:02pm    
Open the file, read the file, write a new file and name it what you want. Where are you stuck?

1 solution

If using Visual Studio .NET, a reference may be added to a project via the Project | Add Reference menu selection. The COM tab within the Add Reference window provides access to COM libraries installed on the system.

Excel is listed as Microsoft.Excel, and the specific name will depend on the Excel version installed. If you have Excel 2003 on my system, so the COM library is listed as Microsoft.Excel 11.0 Object Library. In addition, two namespaces are necessary:

Microsoft.Office.Interop.Excel: Allows you to work with Excel objects via .NET interop.
System.Runtime.InteropServices: Includes the COMException class, allowing you to properly handle COM-related exceptions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900