C# open workbook and suppress Read/Write dialog

S

Scott B

I'm using VS2005 C# to open a workbook invisible, import data from various
worksheets, process some data, then write back to the workbook. My problem is
that when I open the workbook in non-readonly mode, it errors when I try to
write to a cell. I made the workbook visible so I can see what's going on,
and it pops up a dialog with a button to Choose Read/Write for Editing. If I
click the button, my app works fine.
When I open the workbook I set the ReadOnly parm to false, the
IgnoreReadOnlyRecommended parm to true, and the Editable parm to true. I've
also set the Excel.DisplayAlerts to false:

Excel.Workbook obWb = obWorkBooks.Open(filePath, System.Type.Missing,
bReadOnly, System.Type.Missing, System.Type.Missing, System.Type.Missing,
true, System.Type.Missing, System.Type.Missing, !bReadOnly,
System.Type.Missing, System.Type.Missing, System.Type.Missing,
System.Type.Missing, System.Type.Missing);

So what else do I need to do to get this to open as editable with no user
interaction (i.e., with the workbook not visible)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top