EPamperin12
New Member
- Joined
- Jan 8, 2008
- Messages
- 47
I have a form in MS Word that people will fill out for different schools. I want to be able to create a folder that will be used. I have no problems creating the folder.
My problem is if the folder already exists I get an error saying Path/File Access Error.
Any Help is most appreciated.
My problem is if the folder already exists I get an error saying Path/File Access Error.
Code:
Sub TestingSave()
Dim oFFs As FormFields
Dim SchoolName As String
Dim SchoolCode As String
Dim Folder As String
Set oFFs = ActiveDocument.FormFields
oFFs("SchoolName").Select
SchoolName = Selection
oFFs("SchoolCode").Select
SchoolCode = Selection
Folder = "C:" & SchoolName & " (" & SchoolCode & ")"
If Dir(Folder) = "" Then
MkDir (Folder)
oFFs("ReturnValue").Select
Selection = "New Folder Created"
End If
SaveAs ("H:" & SchoolName & " (" & SchoolCode & ")\Testing1.doc")
End Sub
Any Help is most appreciated.