Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Able to open same excel workbook at the same time !

Hi Everyone !
I m a newbie to excel programming but I noticed a bug (??) while
working with excel & VS.NET. I m able to open an excel workbook in 2
different instances of my application & I cant find a way to prevent
this from happening. As a result, 2 different users can , effectively
work on the same workbook, on a same worksheet & over-ride each other's
saves !!
Pls help if anyone has faced a similar problem & if there is anyway to
prevent this !

Thanks in advance
~Ann

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Able to open same excel workbook at the same time !

Surely, one of them will open it as read-only, thereby not being able to
write it back. You can test for this property.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"ann" wrote in message
ups.com...
Hi Everyone !
I m a newbie to excel programming but I noticed a bug (??) while
working with excel & VS.NET. I m able to open an excel workbook in 2
different instances of my application & I cant find a way to prevent
this from happening. As a result, 2 different users can , effectively
work on the same workbook, on a same worksheet & over-ride each other's
saves !!
Pls help if anyone has faced a similar problem & if there is anyway to
prevent this !

Thanks in advance
~Ann



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Able to open same excel workbook at the same time !

That is the problem neither Excel or XP (the OS I am using it with)
detects this & allows me to open & work on the same workbook at the
same time. !

Is there someway to check in C# if a file is already open ?
I found a lot of code using VB that allows a file to be locked while
opening and thereby detecting another open attempt on an already open
file.
Cannot find anything similar in C#

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Able to open same excel workbook at the same time !

Don't know C#, but as I said, if you open it and then check it's ReadOnly,
which is

ActiveWorkbook.ReadOnly

in VBA, and act accordingly.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"ann" wrote in message
ups.com...
That is the problem neither Excel or XP (the OS I am using it with)
detects this & allows me to open & work on the same workbook at the
same time. !

Is there someway to check in C# if a file is already open ?
I found a lot of code using VB that allows a file to be locked while
opening and thereby detecting another open attempt on an already open
file.
Cannot find anything similar in C#

Thanks



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Able to open same excel workbook at the same time !

Thanks for your prompt replies Bob.
I realised that the solution lies in using the VBA. I was using Interop
till now.
I was able to check if the file is already open using VBA.FileOpen
method.

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
Open Workbook at a certain time jswalsh33 Excel Worksheet Functions 2 February 20th 10 01:12 PM
How do I set up a workbook to open on a cell reference every time CAHM Excel Discussion (Misc queries) 2 November 30th 07 05:41 PM
excel exits unexpectedly or hangs the second time I open workbook r_m_i Excel Discussion (Misc queries) 0 February 9th 06 10:14 PM
Why does Excel 2003 open on 3rd tab of workbook every time, not l. Excelfrustrated Excel Worksheet Functions 2 February 7th 05 08:15 PM
How to stop having to re-assign macros every time you open a workbook??? Simon Lloyd[_533_] Excel Programming 3 August 16th 04 03:27 AM


All times are GMT +1. The time now is 01:18 PM.

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

About Us

"It's about Microsoft Excel"