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:
Will be grateful for any help on this.
Dim strDN As String
Dim strFN As String
strDN = Range("E5")
'If Len(Dir("c:\Instructions.doc")) = 0 Then
If Dir("G:\PUBS\PP-MS\INVOICES\" & strDN) = "" Then
MkDir ("G:\PUBS\PP-MS\INVOICES\" & strDN)
'do nothing as the directory already exists
'MsgBox "C:\Text Files\ directory already exists"
strFN = Range("K2") & ".xls"
ChDir "G:\PUBS\PP-MS\INVOICES\" & strDN
ActiveWorkbook.SaveAs Filename:=strFN, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _