ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatically determining if workbook is opened as Read Only (https://www.excelbanter.com/excel-programming/413830-programmatically-determining-if-workbook-opened-read-only.html)

Barb Reinhardt

Programmatically determining if workbook is opened as Read Only
 
I have a data extraction macro that I run monthly and it takes a while to
run, so I periodically open it in another Excel instance as Read Only during
the extraction to get an indication on how much is left to extract.
Unfortunately, I also have a workbook open event that asks if I want to run
the macro, which fires whether it's read only or not. I don't want this
message displayed if the workbook is opened as read only. Is there some way
to do that?

Thanks,
Barb Reinhardt


Barb Reinhardt

Programmatically determining if workbook is opened as Read Only
 
I found what I need. It's ActiveWorkbook.ReadOnly. Now why didn't I think
of that before I posted this? :)

Thanks anyway!
Barb Reinhardt



"Barb Reinhardt" wrote:

I have a data extraction macro that I run monthly and it takes a while to
run, so I periodically open it in another Excel instance as Read Only during
the extraction to get an indication on how much is left to extract.
Unfortunately, I also have a workbook open event that asks if I want to run
the macro, which fires whether it's read only or not. I don't want this
message displayed if the workbook is opened as read only. Is there some way
to do that?

Thanks,
Barb Reinhardt


Mike H

Programmatically determining if workbook is opened as Read Only
 
Seems to work OK

Private Sub Workbook_Open()
If ThisWorkbook.ReadOnly = True Then
MsgBox "This book is read only."
Else
MsgBox "Run"
'run your macro
End If
End Sub

Mike

"Barb Reinhardt" wrote:

I have a data extraction macro that I run monthly and it takes a while to
run, so I periodically open it in another Excel instance as Read Only during
the extraction to get an indication on how much is left to extract.
Unfortunately, I also have a workbook open event that asks if I want to run
the macro, which fires whether it's read only or not. I don't want this
message displayed if the workbook is opened as read only. Is there some way
to do that?

Thanks,
Barb Reinhardt


Tom Ogilvy

Programmatically determining if workbook is opened as Read Onl
 
Why not hold down the shift key while you open the workbook.

--
Regards,
Tom Ogilvy


"Barb Reinhardt" wrote:

I found what I need. It's ActiveWorkbook.ReadOnly. Now why didn't I think
of that before I posted this? :)

Thanks anyway!
Barb Reinhardt



"Barb Reinhardt" wrote:

I have a data extraction macro that I run monthly and it takes a while to
run, so I periodically open it in another Excel instance as Read Only during
the extraction to get an indication on how much is left to extract.
Unfortunately, I also have a workbook open event that asks if I want to run
the macro, which fires whether it's read only or not. I don't want this
message displayed if the workbook is opened as read only. Is there some way
to do that?

Thanks,
Barb Reinhardt


Barb Reinhardt

Programmatically determining if workbook is opened as Read Onl
 
Tom,

Does it work that way when I open a new Excel instance and open the workbook
from the list of last edited files?

Thanks,
Barb Reinhardt



"Tom Ogilvy" wrote:

Why not hold down the shift key while you open the workbook.

--
Regards,
Tom Ogilvy


"Barb Reinhardt" wrote:

I found what I need. It's ActiveWorkbook.ReadOnly. Now why didn't I think
of that before I posted this? :)

Thanks anyway!
Barb Reinhardt



"Barb Reinhardt" wrote:

I have a data extraction macro that I run monthly and it takes a while to
run, so I periodically open it in another Excel instance as Read Only during
the extraction to get an indication on how much is left to extract.
Unfortunately, I also have a workbook open event that asks if I want to run
the macro, which fires whether it's read only or not. I don't want this
message displayed if the workbook is opened as read only. Is there some way
to do that?

Thanks,
Barb Reinhardt


Tom Ogilvy

Programmatically determining if workbook is opened as Read Onl
 
Yes. Once you have the mouse over the filename, hold down the shift key
until it has opened.

--
Regards,
Tom Ogilvy


"Barb Reinhardt" wrote:

Tom,

Does it work that way when I open a new Excel instance and open the workbook
from the list of last edited files?

Thanks,
Barb Reinhardt



"Tom Ogilvy" wrote:

Why not hold down the shift key while you open the workbook.

--
Regards,
Tom Ogilvy


"Barb Reinhardt" wrote:

I found what I need. It's ActiveWorkbook.ReadOnly. Now why didn't I think
of that before I posted this? :)

Thanks anyway!
Barb Reinhardt



"Barb Reinhardt" wrote:

I have a data extraction macro that I run monthly and it takes a while to
run, so I periodically open it in another Excel instance as Read Only during
the extraction to get an indication on how much is left to extract.
Unfortunately, I also have a workbook open event that asks if I want to run
the macro, which fires whether it's read only or not. I don't want this
message displayed if the workbook is opened as read only. Is there some way
to do that?

Thanks,
Barb Reinhardt



All times are GMT +1. The time now is 03:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com