?
Solved

msoFileDialogSaveAs

Posted on 2003-02-23
7
Medium Priority
?
1,760 Views
Last Modified: 2012-06-27
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?
0
Comment
Question by:haz43
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Author Comment

by:haz43
ID: 8005576
never mind figured it out, the best solution is to use the word dialogs, MUCH faster too.

...
    With Dialogs(wdDialogFilePrint)
        ...
        .Execute
    End With
...
0
 

Author Comment

by:haz43
ID: 8005580
oops i meant

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

lol wrong macro
0
 
LVL 27

Expert Comment

by:Dabas
ID: 8005589
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:CleanupPing
ID: 8901241
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 8972522
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
 
LVL 27

Expert Comment

by:Dabas
ID: 8972718
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
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9667907
PAQed - no points refunded (of 100)

Computer101
E-E Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month13 days, 5 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question