View Single Post
 
Old 10-31-2025, 02:37 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,523
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could add the following code to the 'ThisDocument' module of Word's Normal Template (or whatever other template you're using). It will warn you if the document you've just opened is not on a fixed or network drive.
Code:
Private Sub Document_Open()
Dim DrvNm As String, DocNm As String, FSO As Object, Drv As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
DrvNm = Left(ActiveDocument.Path, 1): DocNm = Split(ActiveDocument.Name, "do")(0)
For Each Drv In FSO.Drives
  Select Case Drv.DriveType
    Case 1 'Removable
      If Drv.DriveLetter = DrvNm Then MsgBox DocNm & " is on Removable Drive " & Drv.DriveLetter: Exit For
    Case 2 'Fixed
    Case 3 'Network
    Case 4 'CD-ROM
      If Drv.DriveLetter = DrvNm Then MsgBox DocNm & " is on CD-ROM " & Drv.DriveLetter: Exit For
    Case 5 'RAM-Disk
      If Drv.DriveLetter = DrvNm Then MsgBox DocNm & " is on RAM-Disk " & Drv.DriveLetter: Exit For
  End Select
Next Drv
End Sub
If you already have a Document_Open sub, simply add the code between the first and last lines to it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote