![]() |
How to I get a warning message box
I have a shared workbook and when I enter it sometimes its read only. Not realising I input data and then when I come to save it tells me to save as. Is there anyway you can get a box to pop up saying its read only and you have to click on ok to clear it when you open the file. -- shrek |
How to I get a warning message box
Hi Shrek
Here is some code I use for that purpose. Adapt to suit your needs. Sub OpenPurch() ' ' Open Purchase Ledger routine strPath = ActiveWorkbook.Path StrDrive = Left(strPath, 1) TestPLedg 'Check if file is already open If ActiveWorkbook.ReadOnly = True Then MsgBox "The Purchase Ledger file is currently in use by another user." & _ Chr(10) & "You cannot Enter any Data until you have a Write Access." _ & Chr(10) & Chr(10) & "You can use the file to VIEW data only" End If Sheets("Data Entry").Select End Sub Sub TestPLedg() On Error Resume Next Dim Opfile As String Dim wkname As String ' Opfile = strPath & "\Pledg.xls" wkname = Workbooks("Pledg.xls").Name If Len(wkname) = 0 Then Workbooks.Open filename:=Opfile End If Workbooks("Pledg.xls").Activate On Error GoTo 0 End Sub Regards Roger Govier shrek wrote: I have a shared workbook and when I enter it sometimes its read only. Not realising I input data and then when I come to save it tells me to save as. Is there anyway you can get a box to pop up saying its read only and you have to click on ok to clear it when you open the file. |
How to I get a warning message box
Many thanks for that just one other question. Do I set this up as a new seperate macro in the workbook or set it up within the macro used to open the workbook. Thanks -- shrek |
How to I get a warning message box
Hi
You would need to use this in place of your macro, but change the file name and sheet names to suit your case. Regards Roger Govier shrek wrote: Many thanks for that just one other question. Do I set this up as a new seperate macro in the workbook or set it up within the macro used to open the workbook. Thanks |
All times are GMT +1. The time now is 05:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com