Run-Time Error 75 "Path/File Access Error"

mrmacys

New Member
Joined
Jan 31, 2008
Messages
26
Hi All,

I'm encountering Run time error 75 on the below code. In the excel macro, when the file is not found the below codes run to save the excel workbook,

Dim a
a = MsgBox("Location not Found. Do you want to create this location?", vbCritical + vbYesNo, "Error")
If a = vbYes Then
MkDir "A:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category
MkDir "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category & "\" & Vndr
ActiveWorkbook.SaveAs "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category & "\" & Vndr & "\" & Fname & ".xls"

Else
End
End If


Fname refers to the excel file I'm saving,
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
What does the fName look like? Do you already have an ".xls" at the end of the file name? If you do, then adding another one in the code will cause you some problems (in essence, you'd be saving ".xls.xls").
 
Upvote 0
At a guess your problem may be the drive letter:
Rich (BB code):
MkDir "A:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category
MkDir "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category & "\" & Vndr
 
Upvote 0
FNAME is text

Fname = frmSaveas.txtFname.Text

I'll add some more code so you see where i'm going

When you fill out the user form it will save the file here
ActiveWorkbook.SaveAs "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category & "\" & Vndr & "\" & Fname & ".xls"
.
MsgBox "File Saved", vbInformation, "Sucessful"

frmSaveas.Hide

Exit Sub

If the location is not found then it runs the below code,

ErrorHandler:

frmSaveas.Hide

Dim a
a = MsgBox("Location not Found. Do you want to create this location?", vbCritical + vbYesNo, "Error")
If a = vbYes Then
MkDir "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category
MkDir "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category & "\" & Vndr
ActiveWorkbook.SaveAs "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category & "\" & Vndr & "\" & Fname & ".xls"
'frmSaveas.Show
Else
End
End If
 
Upvote 0
At a guess your problem may be the drive letter:
Rich (BB code):
MkDir "A:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category
MkDir "F:\KNITS\Season\" & Season & "\" & SeaYr & "\" & Category & "\" & Vndr


Good point. Not the F: drive, though, but the A: drive, since A: drives are historically floppy disks.
 
Upvote 0
Could be either (there are still people using floppies, bizarrely), but should be consistent! :)
 
Upvote 0
The problem may be in the file name. If it starts out as a text file (.txt) you may need to strip out the extension .txt so that you can concatenate it later in the code with .xls.
 
Upvote 0
But even is the A: drive is a mapped network drive, the second MkDir for the F: drive should take care of the location. Right? Actually, I've never considered that: do you need a MkDir command for every folder level you create, or can you just use one command to cover it?
 
Upvote 0
My PC at home has 2 floppy drives and a Zip drive! :)
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,185
Members
448,554
Latest member
Gleisner2

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