Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Making a spreadsheet for orders | Excel Worksheet Functions | |||
vba problem with non writable chart height property | Excel Programming | |||
Need help making a spreadsheet for my business. | New Users to Excel | |||
Formula in a writable field | Excel Worksheet Functions | |||
Making a spreadsheet print exactly as it looks on the screen? | Excel Discussion (Misc queries) |