Hi,
I am working on a piece of code which checks to see if a particular directory name exists and if not created it, later saving an excel file into it. It works well first time, but when teh code tries to open and save another file in this same directory it returns error 75
I know its because the created directory is Read Only. How do I set the ditrectroy access writes at the time of craetion?
It seems that it does not even allow me to change it manually from the properties dialogue? Here is teh code:
Code:
Sub ArchiveFile()
Dim strDN As String
Dim strFN As String
ChDir "G:\PUBS\PP-MS\INVOICES"
strDN = Range("E5")
MsgBox strDN
'If Len(Dir("c:\Instructions.doc")) = 0 Then
If Dir("G:\PUBS\PP-MS\INVOICES\" & strDN) = "" Then
MkDir ("G:\PUBS\PP-MS\INVOICES\" & strDN)
Else
'do nothing as the directory already exists
'MsgBox "C:\Text Files\ directory already exists"
End If
strFN = Range("K2") & ".xls"
MsgBox strFN
ChDir "G:\PUBS\PP-MS\INVOICES\" & strDN
ActiveWorkbook.SaveAs Filename:=strFN, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
Will be grateful for any help on this.
Thanks,
Talāt