Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
shrek
 
Posts: n/a
Default 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
  #2   Report Post  
Roger Govier
 
Posts: n/a
Default 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.


  #3   Report Post  
shrek
 
Posts: n/a
Default 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
  #4   Report Post  
Roger Govier
 
Posts: n/a
Default 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


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
How to write a formula that will prevent appearance ERROR MESSAGE Huriiii Excel Worksheet Functions 1 June 22nd 05 12:45 AM
Calculate message Kelly Excel Discussion (Misc queries) 3 June 21st 05 06:53 PM
Not getting "Locked for Editing" message grinnineddies Excel Discussion (Misc queries) 0 June 17th 05 04:29 PM
Macro warning (upon opening) Richard Excel Discussion (Misc queries) 4 February 18th 05 10:43 PM
Pivot Table not valid error message when formatting data 'button'. MDW Excel Discussion (Misc queries) 0 January 27th 05 03:01 PM


All times are GMT +1. The time now is 09:05 AM.

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"