VBA cannot move this file to a folder. Weirdness

hellfire45

Active Member
Joined
Jun 7, 2014
Messages
464
I have a process that is processing and then moving about 60 files to an archive. For some reason this one file cannot be moved.

The files name is: (very long I know, can't help it)
1 2 2018 - xOpen Line Report for y and AVOCENT Product POs RMAs as of 01 02 2018 - x Backlog Report as of 01 02 2018 -y z

It's giving me Run-time error 76 Path Not Found. I find this weird since it does not give this error for any of the other 60 or so files. The file is not corrupt.

The relevant code I'm using is below:

Code:
folderpath = "I:\ASM\All\CRT\Reporting\In Consolidation Process\Reports\"

If Dir("I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Dated Report Archive\" & Format(Date, "yyyy-mm-dd"), vbDirectory) = "" Then
            MkDir ("I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Dated Report Archive\" & Format(Date, "yyyy-mm-dd") & "\")
End If

destinationpath = "I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Dated Report Archive\" & Format(Date, "yyyy-mm-dd") & "\"



fso.MoveFile folderpath & strFileName, destinationpath & strFileName

strFileName is a variable that changes to reflect each file name in the folder. They are all .xlsx files


Thank you yet again friends.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
My guess would be that your share server has a limit for the number of characters for a file name, which includes the path. But I have no solution to offer as a work around.
 
Last edited:
Upvote 0
My guess would be that your share server has a limit for the number of characters for a file name, which includes the path. But I have no solution to offer as a work around.


Maybe I can manually change this particular pain in the butts file name to something short and then trying to transfer it.
 
Upvote 0
You could try it to see if that is the problem. But changing the file name would make it difficult to find in the future. I think I would do a little QE and see if the source can't do a better job of naming the files.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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