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.
 
Ad

Advertisements

Joined
Mar 9, 2017
Messages
2
Reaction score
2
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.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top