user1591538
user1591538

Reputation:

VBA: How can I determine the current path of a document where a macro is being called?

An external .NET program which I didn't program by myself and I do not have influance on its code calls a macro in a Word document. The macro is mine.

How can I let the macro to know where its containing document resides?

The approach with ActiveDocument.Path can't be used due to the danger of too many other already opened documents, so that the user could possibly change the focus on one of them.

Thanks for your answers in advance

Upvotes: 1

Views: 6659

Answers (1)

GSerg
GSerg

Reputation: 78185

ActiveDocument.Path 

Almost there:

ThisDocument.Path

Upvotes: 2

Related Questions