Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Exclusive Access

One more question :-)

How can I check to see if my workbook is already open exclusive?

I am using this code to set my workbook exclusive.

Application.DisplayAlerts = False
'
Windows("JAX_PassCounts_v0.9.8.xls").Activate
ActiveWorkbook.ExclusiveAccess
Do
On Error Resume Next
ActiveWorkbook.Save
Loop Until ActiveWorkbook.Saved = True
'
Application.DisplayAlerts = True

How can I write in here that if the file is already exclusive to exit the sub?
I tried somthing like

If ActiveWorkbook.ExclusiveAccess = True then
Exit Sub
End If

But this did not work, it tried to set the file exclusive and errored out.

Thanks for any help!
--
Stephen
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Exclusive Access

This was in the VBA help file:

If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
End If




"Stephen sjw_ost" wrote in message
...
One more question :-)

How can I check to see if my workbook is already open exclusive?

I am using this code to set my workbook exclusive.

Application.DisplayAlerts = False
'
Windows("JAX_PassCounts_v0.9.8.xls").Activate
ActiveWorkbook.ExclusiveAccess
Do
On Error Resume Next
ActiveWorkbook.Save
Loop Until ActiveWorkbook.Saved = True
'
Application.DisplayAlerts = True

How can I write in here that if the file is already exclusive to exit the
sub?
I tried somthing like

If ActiveWorkbook.ExclusiveAccess = True then
Exit Sub
End If

But this did not work, it tried to set the file exclusive and errored out.

Thanks for any help!
--
Stephen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Exclusive Access

You would need to add a line to exit the sub if it is already exclusive
access:

If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
Else
Exit Sub
End If



"Stephen sjw_ost" wrote in message
...
One more question :-)

How can I check to see if my workbook is already open exclusive?

I am using this code to set my workbook exclusive.

Application.DisplayAlerts = False
'
Windows("JAX_PassCounts_v0.9.8.xls").Activate
ActiveWorkbook.ExclusiveAccess
Do
On Error Resume Next
ActiveWorkbook.Save
Loop Until ActiveWorkbook.Saved = True
'
Application.DisplayAlerts = True

How can I write in here that if the file is already exclusive to exit the
sub?
I tried somthing like

If ActiveWorkbook.ExclusiveAccess = True then
Exit Sub
End If

But this did not work, it tried to set the file exclusive and errored out.

Thanks for any help!
--
Stephen



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Exclusive Access

Makes sense to check for Multiuser first. Thank you very much for the reply.
I understand it now as well.
--
Stephen


"JLGWhiz" wrote:

You would need to add a line to exit the sub if it is already exclusive
access:

If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
Else
Exit Sub
End If



"Stephen sjw_ost" wrote in message
...
One more question :-)

How can I check to see if my workbook is already open exclusive?

I am using this code to set my workbook exclusive.

Application.DisplayAlerts = False
'
Windows("JAX_PassCounts_v0.9.8.xls").Activate
ActiveWorkbook.ExclusiveAccess
Do
On Error Resume Next
ActiveWorkbook.Save
Loop Until ActiveWorkbook.Saved = True
'
Application.DisplayAlerts = True

How can I write in here that if the file is already exclusive to exit the
sub?
I tried somthing like

If ActiveWorkbook.ExclusiveAccess = True then
Exit Sub
End If

But this did not work, it tried to set the file exclusive and errored out.

Thanks for any help!
--
Stephen




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
File in Exclusive Use SSi308 Excel Discussion (Misc queries) 3 June 3rd 10 08:59 PM
exclusive macros Fan924 Excel Programming 4 December 10th 08 09:06 AM
Exclusive use Problem TC Excel Discussion (Misc queries) 0 July 12th 05 06:09 PM
How to check for Exclusive access to a workbook Andy Excel Programming 1 November 4th 04 12:31 PM


All times are GMT +1. The time now is 05:11 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"