ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Path/File access error (https://www.excelbanter.com/excel-discussion-misc-queries/190455-path-file-access-error.html)

Ayo

Path/File access error
 
I have this macro that I created that seem to to working fine except I keep
getting the "Path/File access error" after the code as run for a while. Then
I get a "Method SaveCopyAs of Object Workbook failed" error" whenI try to
clear the initial error.
This code is suppose to loop through a range and perform a action between
the for loop below. Everything seem to be working fine, at least through 45
loops, more or less, then the error pops up. I don't know how to find the
problem so I can try and fix it.
Any ideas?

'''''''''' Beginning of For Loop ''''''''''''''
For Each c In Worksheets("RFDS Tracker").Range("A4:A" & lastRow)
Worksheets("RFDS Tracker").Activate
c.Activate
active_cell = c.Address

'''''''''' Ending of For Loop '''''''''''''''''''''
Worksheets("RFDS Form").Activate

'''''''''''' RENAME THE RFDS WORKSHEET ''''''''''''''''''''
Worksheets("RFDS Form").Select
Worksheets("RFDS Form").Name = Worksheets("RFDS Form").Range("B8").Value

'''''''''''' SAVE THE FILE ''''''''''''''''''''
fileName = ActiveSheet.Range("B8").Value & "_Ver" &
ActiveSheet.Range("I19").Value & " " _
& Format(Date, "mmm d yyyy")
ActiveWorkbook.SaveCopyAs Saveto_Folder & fileName & ".xls"

Worksheets(Left(fileName, 6)).Select
Worksheets(Left(fileName, 6)).Name = "RFDS Form"
Next c

Ayo

Path/File access error
 
I just ran the code again manually and nothing happened. Everything worked as
it should with no errors.
What could be the problem. I am stumped.

"Ayo" wrote:

I have this macro that I created that seem to to working fine except I keep
getting the "Path/File access error" after the code as run for a while. Then
I get a "Method SaveCopyAs of Object Workbook failed" error" whenI try to
clear the initial error.
This code is suppose to loop through a range and perform a action between
the for loop below. Everything seem to be working fine, at least through 45
loops, more or less, then the error pops up. I don't know how to find the
problem so I can try and fix it.
Any ideas?

'''''''''' Beginning of For Loop ''''''''''''''
For Each c In Worksheets("RFDS Tracker").Range("A4:A" & lastRow)
Worksheets("RFDS Tracker").Activate
c.Activate
active_cell = c.Address

'''''''''' Ending of For Loop '''''''''''''''''''''
Worksheets("RFDS Form").Activate

'''''''''''' RENAME THE RFDS WORKSHEET ''''''''''''''''''''
Worksheets("RFDS Form").Select
Worksheets("RFDS Form").Name = Worksheets("RFDS Form").Range("B8").Value

'''''''''''' SAVE THE FILE ''''''''''''''''''''
fileName = ActiveSheet.Range("B8").Value & "_Ver" &
ActiveSheet.Range("I19").Value & " " _
& Format(Date, "mmm d yyyy")
ActiveWorkbook.SaveCopyAs Saveto_Folder & fileName & ".xls"

Worksheets(Left(fileName, 6)).Select
Worksheets(Left(fileName, 6)).Name = "RFDS Form"
Next c



All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com