Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read/write Permissions on network over VPN link??

Status
Not open for further replies.

cresbydotcom

Technical User
May 22, 2006
234
Hi

we have a VPN to the master server in HQ.

When I try to open a spreadsheet I look for the words read only on the title to be sure if it is already being accessed. However this does not appear to answer all situations.
My PC is the local server (we have a wireless router which bypasses my PC) for others in this location but this is not applicable for the files in question.

My question is:
can I access the file using the file object and interogate the status before I open (instead of above).

If I find the answer before replies come in I will post but all help is welcome.

TIA

there is a tide in the affairs of man that you Cnut ignore.................
 
I have changed my method to:

Code:
Set f = fs.GetFile("T:\folder\Master List.xls")
rw = 0 
If f.Attributes And 1 = vbReadOnly Then rw = MsgBox("read only Cancel??", vbYesNo)
If rw = vbYes Then Exit Sub
'open file here

I am now waiting to see if this works over the VPN.

Any comments?

there is a tide in the affairs of man that you Cnut ignore.................
 
silly Cresby! Yes Yes it should be:
Code:
(f.Attributes And 1) = vbReadOnly
the latency of the VPN was thought to be a factor - I am not so sure now.


there is a tide in the affairs of man that you Cnut ignore.................
 
looks like a dead end. The code above does not yield any read only info - I can't see anything yet about file sharing.

and the VBA code
Code:
For n = 1 To ActiveWorkbook.Windows.Count
 If InStr(1, LCase(ActiveWorkbook.Windows.Item(n).Caption), "Master List") > 1 Then
  If InStr(1, LCase(ActiveWorkbook.Windows.Item(n).Caption), "Read-Only") > 1 Then rw = 1
 End If
Next
If rw = 1 Then MsgBox ("read only PAL!"): Exit Sub
does not show "[Read Only]" text as part of the window caption even though eye-balling it does!

Could be a the Netgear ProSafe VPN Firewall box.

Any ideas on how to read file sharing status in VBA?

TIA


there is a tide in the affairs of man that you Cnut ignore.................
 
Hmmmmmmmmm, looks like I needed most of the answer before asking the Help app.

this does it
Code:
If ActiveWorkbook.ReadOnly Then MsgBox ("read only PAL!"): Exit Sub

It is always obvious when you know! Now why can't I see the property in the watch window?



there is a tide in the affairs of man that you Cnut ignore.................
 
Anyway, your logic is wrong about case sensitive comparison:
If InStr(1, [!]LCase[/!](ActiveWorkbook.Windows.Item(n).Caption), "[!]M[/!]aster [!]L[/!]ist") > 1 Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top