Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel Automation: Open existing Excel file as "new"

Tags:

I want to have a "one-click" excel export feature for my application. I therefore need to create an excel file in a temporary location, because I need to use a third-party component to do so.

I want Excel to then open up the file. I can get to that point; however Excel always remembers the location it loaded the file from. I'd like the loaded file to appear as a "new" file which is not saved to a specific location, so when the user wants to hit "save" (not save as) or close Excel it reminds them of unsaved changes.

I'm using Excel Automation from C# on .net 3.5

like image 244
Johannes Rudolph Avatar asked Jul 08 '09 15:07

Johannes Rudolph


People also ask

How do I get Excel to automatically update from one file to another?

Go to the destination worksheet and click the cell where you want to link the cell from the source worksheet. On the Home tab, click on the drop-down arrow button of Paste, and select Paste Link from “Other Paste Options.” Or right-click in the cell on the destination worksheet and choose Paste Link from Paste Options.

How do you open a recent document created on the same computer in Excel?

Click the File tab. Click Recent. Select the check box to Quickly access this number of recent documents: and choose how many files you want to see. Links to those files will appear above Info in the navigation bar, regardless of where you are in the Backstage View.


1 Answers

You can specify any existing Excel workbook as the template. Then you use the Workbooks.Add method to open a new workbook, with the Template parameter pointing to the temporary template.

like image 53
GvS Avatar answered Oct 02 '22 23:10

GvS