View Single Post
 
Old 11-22-2020, 10:35 PM
Charles Kenyon Charles Kenyon is offline Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,537
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I believe you are correct as to the scope of a public variable declared outside of a procedure. See Understanding scope and visibility (VBA) | Microsoft Docs. I suspect that "FilePath" is not the best name for your variable. I would suggest:
Code:
Public strFilePath as String
[Edit for future readers of this thread: See my later responses about document variables and Greg Maxey's about class modules (like ThisDocument) later in this thread. How to use such a variable depends on what kind of template/document it is being used in.]

Last edited by Charles Kenyon; 11-24-2020 at 05:09 PM.
Reply With Quote