![]() |
|
#1
|
|||
|
|||
|
Hi!
I have a macro, that should show a file save as dialog and save the file: Code:
Sub ShowSaveAsDialog() Dim dlgSaveAs As FileDialog Application.FileDialog(msoFileDialogSaveAs).InitialFileName = FName Set dlgSaveAs = Application.FileDialog( _ FileDialogType:=msoFileDialogSaveAs) dlgSaveAs.Show End Sub In this second dialog the initial file name is not the same as in the first dialog, and also the location for saving not as required. Can someone please explain why the macro isn't working? Last edited by Franci; 01-07-2023 at 05:20 AM. Reason: adding links to pictures |
|
#2
|
|||
|
|||
|
Does this help?
Code:
Sub ShowSaveAsDialog()
Dim dlgSaveAs As FileDialog
Set dlgSaveAs = Application.FileDialog(msoFileDialogSaveAs)
dlgSaveAs.InitialFileName = "test.docx"
If dlgSaveAs.Show <> 0 Then
dlgSaveAs.Execute
End If
End Sub
|
|
#3
|
|||
|
|||
|
In the VB Editor you can use F1 to look up the online documentation for the object, method, or property the cursor is currently in.
FileDialog.Show method (Office) | Microsoft Learn FileDialog members (Office) | Microsoft Learn |
|
#4
|
|||
|
|||
|
Quote:
Thank you Brian, that works. |
|
#5
|
|||
|
|||
|
Quote:
Thank you for your suggestion. |
|
| Tags |
| dialog, msofiledialogsavea, save as |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Excel 2000 Backup File Modification Date Not Changing When I Save an XLS File
|
skeezix | Excel | 3 | 01-10-2021 04:51 PM |
save dialog box promt doesn't save file
|
brmveen | Word VBA | 2 | 11-04-2015 12:51 AM |
Auto Save Every Page(s) as a separate file, and name each new file automatically by the first line?
|
commissarmo | Word VBA | 3 | 03-14-2015 12:53 AM |
error: You are attempting to save a file format that is blocked by file block setting
|
zatlas1 | Office | 8 | 04-28-2012 02:37 PM |
Word Macro: Save file as text with current file name
|
jabberwocky12 | Word VBA | 2 | 10-22-2010 12:23 PM |