• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 332
  • Last Modified:

Stop wdDialogFileSaveAs from defaulting to local drive

The code below works great but if the user doesn't have access to the shared location (10.0.0.1) it defaults to a local drive. Is there a way to stop this and spit out a message saying it can't access the location due to network security or connection.

Private Sub CommandButton1_Click()
With Dialogs(wdDialogFileSaveAs)
    .Name = "\\10.0.0.1\secured1\saves\" & ActiveDocument.Name
    .Show
End With

End Sub
0
cseink
Asked:
cseink
  • 2
1 Solution
 
mvidasCommented:
Hi cseink,

Give the following a try; it should work as you need it. The Dir method will error out if the user doesn't have access to the location, so we can test to see if it returns an error or not:

Private Sub CommandButton1_Click()
 Dim vDir As String
 vDir = vbNullChar
 On Error Resume Next
 vDir = Dir("\\10.0.0.1\secured1\saves\")
 On Error GoTo 0
 If vDir = vbNullChar Then
  MsgBox "You can not access the location due to network security or connection"
 Else
  With Dialogs(wdDialogFileSaveAs)
   .Name = "\\10.0.0.1\secured1\saves\" & ActiveDocument.Name
   .Show
  End With
 End If
End Sub

Matt
0
 
cseinkAuthor Commented:
Pefect. Thanks a million
0
 
mvidasCommented:
Glad to help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now