view doc folder and name

setup

for revising manuscripts or MW docs per review comments, i make a copy of the doc with comments and rename the copy by updating the version number at the end of the file name. e.g. "abstract.for.ASCO.v1" would be updated to "abstract.for.ASCO.v2". this creates a caveat that it's difficult to quickly check the file name in MS Word, where only the first couple of characters are shown on the top of the window. clicking on it would show file name but still suffers the similar limitation with long names.

besides file names, sometimes i want to tell from which folder i'm opening the current doc. i may have copied a file to Desktop for testing and therefore don't want to mess up "the real one", or have downloaded a copy from cloud since the cloud's temporarily down, or be dealing with manuscripts, all of which i name "manuscript". so, on top of file name, i'd also want to check out the folder.

now, time for one-click solutions.

solution

the plan

  1. find out file name and folder.
  2. pop up a MsgBox to display the info.

programming language & module(s)

  • VBA

file preps

make the doc to be processed the active document, i.e. the one where the cursor currently is in.

variables to customize

none.

the script

vDocName
Sub vDocName()
MsgBox "doc name: " & vbCr & _
ActiveDocument.Name & vbCr & vbCr & _
"folder:" & vbCr & ActiveDocument.Path
End Sub

output

image.png

note to self

none.

Some rights reserved
Except where otherwise noted, content on this page is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.