Ciaran Gallagher
Ciaran Gallagher

Reputation: 4020

How to programmatically save an OPEN Excel Document

I have UI tests. When the UI tests finish, they open the result files in an Excel document (Excel 2007 is installed on the test environment) - but the problem is that the excel document is not saved anywhere on the computer. They exist only when the AutoRecover feature saves the temporary files as a .xar file, so this is useless to us.

We use a C# .NET program to launch the UI tests (and do a bunch of other things), so I'm looking to see if it's possible to save this OPENED excel document programmatically.

Is that possible?

Thanks

Upvotes: 1

Views: 1713

Answers (1)

Amit
Amit

Reputation: 22076

This may help you How to: Save Workbooks

Example

This example creates a new workbook, prompts the user for a file name, and then saves the workbook.

Set NewBook = Workbooks.Add
Do
    fName = Application.GetSaveAsFilename
Loop Until fName <> False
NewBook.SaveAs Filename:=fName

Upvotes: 1

Related Questions