dmorgan20
dmorgan20

Reputation: 363

Moving files from one folder to another using access vba

I am trying to move an excel file from one folder to another.

I have been modifying the code but only getting it to partially work.

My Code:

Name "C:\Excel\ID.xlsm" As "C:\Archive\ " & AuditID & ".xlsm"

Whats Happening:

When I run this code I get a debug saying: Path/File access error. Once its debugged, if I press 'play' again it successfully moves the file to the new path and renames it correctly.

So I am a little confused as to why I get the error message in the first place.

I have also Tried:

Name "C:\Excel\ID.xlsm" As "C:\Archive\ '" & AuditID & "'.xlsm"

Upvotes: 0

Views: 2030

Answers (1)

Sergey S.
Sergey S.

Reputation: 6336

Try

Name "C:\Excel\ID.xlsm" As "C:\Archive\" & AuditID & ".xlsm"

I removed space after last \

Upvotes: 1

Related Questions