msoFileDialogSaveAs

The following code is part of a custom saving vba macro used in word :

Private Sub ShowFileSaveAsDialog(ByVal strDir As String)
   
    Dim fd As FileDialog

    Set fd = Application.FileDialog(msoFileDialogSaveAs)
    With fd
        .InitialFileName = strDir
        If .Show = CANCEL_PRESSED Then
        Else
            .Execute
        End If
    End With
    Set fd = Nothing

End Sub

The saveas dialog box is shown, .execute method actually does the save. Works right? Well, not quite. If one document is open, it works perfectly. However, with more than one document open, Word seems to determine which document is to be saved at random, regardless of which was active and had focus. Very frustrating when a user names a file one thing and then finds out it saved a copy of something else. Anyone know of a way to force it to save the correct active document?
haz43Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Computer101Connect With a Mentor Commented:
PAQed - no points refunded (of 100)

Computer101
E-E Admin
0
 
haz43Author Commented:
never mind figured it out, the best solution is to use the word dialogs, MUCH faster too.

...
    With Dialogs(wdDialogFilePrint)
        ...
        .Execute
    End With
...
0
 
haz43Author Commented:
oops i meant

Private Sub ShowFileSaveAsDialog(ByVal strDir As String)
   
    With Dialogs(wdDialogFileSaveAs)
        .Name = strDir
        .Show
    End With
   
End Sub

lol wrong macro
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
DabasCommented:
I have Word 2000 and tried to run you macro.

It seems that I do not have FileDialog on my system.
Can you please check your references as to which library this function comes from?

My guess is that the problem is that you are using the Application object to call FileDialog.
If this event also exists for a document object, (very probably so), then I would assume that changing your set statement accordingly should solve your problem

Dabas
0
 
CleanupPingCommented:
haz43:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
DanRollinsCommented:
haz43, an EE Moderator will delete this for you.
Moderator, my recommended disposition is:

    DELETE this question (refund points).

DanRollins -- EE database cleanup volunteer
0
 
DabasCommented:
Moderator:
Disagree.
Question was answered. Or at least there was an attempt to reach an answer.
Either Points to Dabas or PAQ/NO Refund

Dabas
0
All Courses

From novice to tech pro — start learning today.