Save As

Paddy1979

Well-known Member
Joined
Sep 23, 2005
Messages
608
Hello everyone.

Is its possible it check whether a users C:\ is in read only mode i.e you cannot save a file there ?

As my macro is falling over as it saves the file as C:\MPimport.xls but if this is prevented i need to save as H:\MPimport.xls

Many Thanks
Patrick
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Maybe you can just use error handling. This is a very basic example, but maybe you can expand on it:

Code:
Sub SaveToC
On Error Goto Handler
'Code to save in C:\
 
Exit Sub
Handler:
'Code to save in H:\
End Sub
Hope that helps.
 
Upvote 0
Hi Patrick

Here's a function that should work to test this:

Code:
Function DriveWriteable(DriveLetter As String) As Boolean
Dim i As Integer
i = FreeFile
On Error Resume Next
Open DriveLetter & ":\TestAccess.txt" For Binary Access Write As #i
If Err = 0 Then
    DriveWriteable = True
    Close #i
End If
End Function

Use in code like:

Code:
If DriveWriteable("C") Then
    'save to C drive
Else
  'save to other drive
End If
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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