LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Dialogs SaveAs with different directory

Hi Don,

I already thought about this dialog-routine but never used it - maybe I
should do it now.

Thank you very much
Thomas


Don Lloyd schrieb:

Hi Thomas,

Below is a copy of a routine that I use to prompt users to save as

The part that may interest you is the Suggest variable - make this whatever
you want, e.g. "C;\Myfolder\" adding subfolders if required (end with a \).

Also included is a check to see if the file exists - remove if not needed -
from Set Fs = . . . . down to End If.

Sub BtnSaveAs()
Dim Suggest, res, Fname, Hdr, Fs
Application.DisplayAlerts = False
Suggest = ThisWorkbook.Path & "\"
Hdr = "Please choose a Destination for the Copy, give it a name then click
Save."
GetFname:
Fname = Application.GetSaveAsFilename(Suggest, fileFilter:="Excel File
(*.xls), *.xls)", Title:=Hdr)
If Not Fname = False Then
Set Fs = CreateObject("Scripting.FileSystemObject")
If Fs.FileExists(Fname) Or Fs.FileExists(Fname & ".xls") Then
res = MsgBox(Fname & " already exists." _
& " Do you want to replace it?", vbYesNo, "Duplicate")
If res = vbNo Then GoTo GetFname:
End If
ThisWorkbook.SaveAs Fname
End If
Xit:
Application.DisplayAlerts = True
End Sub

Hope this helps

Don

"Thomas Stroebel" wrote in message
...

Hello,

I need help for the following problem.

An already existing file will be changed by my macro and at the end I
want the user to save the file with a different name in a different
directory with the option to change the filename or directory. Therefore I
use the excel-standard-dialog "save as". But I want the dialog to start in
another path as the path the original-file is stored in. But also I use
the ChDrive and ChDir Parameters the dialog even starts in the
original-file-path. I think this is standard for the dialog and I should
maybe use a parameter in the show-arguement? The code is below.

Is there anybody to help me?

Thanks in advance
Thomas



Option Explicit
Sub SaveMyFile()
Dim xFileName, xAnswer

ChDrive "J"
ChDir "J:\myfolder"

xFileName = "testme.xls"
xAnswer = Application.Dialogs(xlDialogSaveAs).Show(xFileName )
End Sub







 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
open in old directory save in new directory tim64[_2_] Excel Programming 0 June 15th 05 07:48 PM
Dialogs nc Excel Discussion (Misc queries) 1 March 23rd 05 02:17 PM
problems with dialogs François Excel Programming 5 February 21st 05 10:34 AM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 06:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"