PC Review


Reply
Thread Tools Rate Thread

C# open workbook and suppress Read/Write dialog

 
 
=?Utf-8?B?U2NvdHQgQg==?=
Guest
Posts: n/a
 
      6th Oct 2006
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)?

--
Scott B
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2NvdHQgQg==?=
Guest
Posts: n/a
 
      9th Oct 2006
Anybody have some input on this? I really need to fix it.
--
Scott B


"Scott B" wrote:

> 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)?
>
> --
> Scott B

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to suppress "Do you want to save" dialog when closing a workbook in a Macro? CW Microsoft Excel Discussion 3 15th Jun 2007 04:02 PM
Suppress the Write Conflict Dialog Box =?Utf-8?B?RWFybENQaGlsbGlwcw==?= Microsoft Access VBA Modules 4 4th Apr 2007 08:16 PM
Read/Write from/to a closed workbook Alan Microsoft Excel Programming 3 13th Jun 2006 01:54 PM
opening workbook as read-only or write-enabled =?Utf-8?B?YXJjaGlib3k=?= Microsoft Excel Programming 1 31st Jan 2006 01:11 PM
Suppress dialog while opening a write protected Excel document from VBS Stefan Microsoft Excel Programming 1 17th Feb 2004 12:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:45 AM.