haz43
asked on
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(mso FileDialog SaveAs)
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?
Private Sub ShowFileSaveAsDialog(ByVal
Dim fd As FileDialog
Set fd = Application.FileDialog(mso
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?
ASKER
oops i meant
Private Sub ShowFileSaveAsDialog(ByVal strDir As String)
With Dialogs(wdDialogFileSaveAs )
.Name = strDir
.Show
End With
End Sub
lol wrong macro
Private Sub ShowFileSaveAsDialog(ByVal
With Dialogs(wdDialogFileSaveAs
.Name = strDir
.Show
End With
End Sub
lol wrong macro
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
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
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?
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?
haz43, an EE Moderator will delete this for you.
Moderator, my recommended disposition is:
DELETE this question (refund points).
DanRollins -- EE database cleanup volunteer
Moderator, my recommended disposition is:
DELETE this question (refund points).
DanRollins -- EE database cleanup volunteer
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
Disagree.
Question was answered. Or at least there was an attempt to reach an answer.
Either Points to Dabas or PAQ/NO Refund
Dabas
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
...
With Dialogs(wdDialogFilePrint)
...
.Execute
End With
...