Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Problem making a spreadsheet writable

I'm using C# to open a spreadsheet invisibly, read some data from it, then
write back to it. The problem is that it it is not coming up editable - it
errors when I try to write to a cell. However, if I open the spreadsheet
visibly, after a number of seconds a dialog pops up "File xxx is now
available for editing. Choose Read-Write to open it for editing", and if you
click the Read-Write button, it works OK.

Here's my code for opening the spreadsheet. The comment is something I found
for the parameters C# needs (since it doesn't handle optional parameters like
VB).
So I'm setting ReadOnly = false, IgnoreReadOnlyRecommended = true, and
Editable = true.

What is wrong? Why does it take the user interaction to open it as
editable/writable? And since it takes about 12-14 seconds for that Read-Write
dialog to pop up, it's unacceptable.


/*
* Workbooks.Open(
[In] string Filename,
[In, Optional] object UpdateLinks,
[In, Optional] object ReadOnly,
[In, Optional] object Format,
[In, Optional] object Password,
[In, Optional] object WriteResPassword,
[In, Optional] object IgnoreReadOnlyRecommended,
[In, Optional] object Origin,
[In, Optional] object Delimiter,
[In, Optional] object Editable,
[In, Optional] object Notify,
[In, Optional] object Converter,
[In, Optional] object AddToMru,
[In, Optional] object Local,
[In, Optional] object CorruptLoad)
*/

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);



--
Scott B
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Problem making a spreadsheet writable

Never mind - dumb mistake on my part. There's nothing wrong with my code to
open the spreadsheet; I had used a filestream along with the OpenFileDialog
and tried to open the spreadsheet before closing the stream - so the stream
already had the file opened. Actually, in this case I didn't need the stream
at all (I had copied from some other code where I did).
--
Scott B


"Scott B" wrote:

I'm using C# to open a spreadsheet invisibly, read some data from it, then
write back to it. The problem is that it it is not coming up editable - it
errors when I try to write to a cell. However, if I open the spreadsheet
visibly, after a number of seconds a dialog pops up "File xxx is now
available for editing. Choose Read-Write to open it for editing", and if you
click the Read-Write button, it works OK.

Here's my code for opening the spreadsheet. The comment is something I found
for the parameters C# needs (since it doesn't handle optional parameters like
VB).
So I'm setting ReadOnly = false, IgnoreReadOnlyRecommended = true, and
Editable = true.

What is wrong? Why does it take the user interaction to open it as
editable/writable? And since it takes about 12-14 seconds for that Read-Write
dialog to pop up, it's unacceptable.


/*
* Workbooks.Open(
[In] string Filename,
[In, Optional] object UpdateLinks,
[In, Optional] object ReadOnly,
[In, Optional] object Format,
[In, Optional] object Password,
[In, Optional] object WriteResPassword,
[In, Optional] object IgnoreReadOnlyRecommended,
[In, Optional] object Origin,
[In, Optional] object Delimiter,
[In, Optional] object Editable,
[In, Optional] object Notify,
[In, Optional] object Converter,
[In, Optional] object AddToMru,
[In, Optional] object Local,
[In, Optional] object CorruptLoad)
*/

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);



--
Scott B

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a spreadsheet for orders craigwojo Excel Worksheet Functions 4 August 23rd 06 09:33 PM
vba problem with non writable chart height property ppcm Excel Programming 1 February 13th 06 06:17 PM
Need help making a spreadsheet for my business. malik641 New Users to Excel 23 February 1st 06 03:28 PM
Formula in a writable field Quinn Ramsey Excel Worksheet Functions 3 November 15th 05 04:35 PM
Making a spreadsheet print exactly as it looks on the screen? Liz Excel Discussion (Misc queries) 1 August 31st 05 10:30 PM


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"