VBA and sharepoint

laurawr

New Member
Joined
Mar 3, 2011
Messages
32
Hi
I have an excel document stored on sharepoint that will be used by all of my colleagues.

However even though people have had the sufficient training on sharepoint people still manage to open an excel document on sharepoint as read only and do a few hours of work then cannot save the data due to it being in read only mode.

How can i bring message box up if the document opened via sharepoint is read only and close the application for them to re open it as the correct format... currently i am using this code and it does not work.

Code:
Private Sub Workbook_Open()
If Me.ReadOnly = True Then
       MsgBox "This is a read only document. Please open this document as "Checkout and Edit'"
    End If
End Sub

Thanks in advance

L
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try this,



Private Sub Workbook_Open()
If ActiveWorkbook.ReadOnly Then
MsgBox "This is a read only document. Please open this document as "Checkout and Edit'"
End If
End Sub


Thanks,
Ogo
 
Upvote 0
Hi,
thanks for your reply,

but i have already tried your suggestion aswell and it still wont work, i really dont know why

:/

Thanks
 
Upvote 0
Your code didn't compile, but this worked for me with macros enabled:

Code:
Private Sub Workbook_Open()
    If Me.ReadOnly = True Then
       MsgBox "This is a read only document. Please open this document as ""Checkout and Edit""."
    End If
End Sub

Make sure that the code is in the ThisWorkbook module.
 
Upvote 0
Hi
I have tried that but however it still doesnt work.

It is already in the ThisWorkbook module aswell.. when I open the document on sharepoint it just runs as usual with no messagebox.

?

Thanks

L
 
Upvote 0
I am convinced this is more than just a read-only flag that Excel normally sees. The SharePoint site has a different flag on the file and I don't know how to remove it either. Please post here if you learn how to solve this problem as I have the same one.
 
Upvote 0
I can check it but I don't know the syntax to use those. Can you provide some code, I'll test it and hopefully we'll solve this problem for me and for the other person on this post. Thanks!
 
Upvote 0
Andrew, the checkinwithversion worked. All I did was issue this command:

ActiveWorkbook.CheckInWithVersion

And my file was checked back in on SharePoint. However, I do NOT see a checkout option on activeworkbook. Can you help with that?

We're getting very close!!!!!!!!!!!!!!!!!!!!!
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,223
Members
452,896
Latest member
IGT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top