Visual Basic (Word) doesn't recognize "My" as in My.Application.FileSystem.RenameFile

Joined
Mar 9, 2017
Messages
2
Reaction score
2
I'm returning to VBA after years, and I'm trying to rename files in VBA (working inside Word)

The command:

My.Computer.FileSystem.RenameFile strOld, strNew

gets the following error: Compile error: Variable Not defined and highlights "My"

My.computer.FileSystem.RenameFile locFolder

I'm assuming that I'm missing an include or import or something, but I haven't done this in so long I'm not sure how.

Please help!

Thanks, Michael T.
 
I figured it out!

In VBA (I'm currently in Word), the "My.Computer" object isn't required in the statement

I simply used the FileSystem.RenameFile statement and it seems to be working.
 
Back
Top