Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 17th, 2008, 02:23 PM
Registered User
Join Date: Jun 2008
Location: Nashville, Tennessee, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to FriendlyGrizzly Send a message via Yahoo to FriendlyGrizzly
Default UserForm to Save File with default name

Here is what I need to do:

I want to have a UserForm that, when opened, offers the user the chance to save a COPY of the open workbook, with a default name already filled out (but which the user can change. The place to save the file should be the same folder as the original.

Example: file is in C:\ExcelStuff and is called Example.xls
The default new file name should be: Example-SPARE.xls and go to the C:\ExcelStuff folder.

Clicking a "OK" button or similar should cause this to happen.
Of course, there should be a cancel capability.

Once the user has clicked to do this, the new file should be the one on the screen.

Thanks in advance to any of you who can lend me a hand on this.


Kodiak Services Company
+1 615 874 8495
  #2 (permalink)  
Old June 17th, 2008, 10:49 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts


You can use the save as dialog through code

Sub SaveasDialog()

Dim sWBName As String
Dim sPAth As String
On Error Resume Next

sWBName = ActiveWorkbook.Name
sWBName = Left(sWBName, Len(sWBName) - 4)

sPAth = "C:\ExcelStuff\"
Application.Dialogs(xlDialogSaveAs).Show sPAth & sWBName & "-SPARE.xls"

End Sub



VBA Tips & Tricks (http://www.vbadud.blogspot.com)

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I save Crystal Report File to Image File? Muhammad Akbar Crystal Reports 0 July 10th, 2007 05:33 PM
Save PDF file as text file in VB.Net kvenkatu Classic ASP Basics 0 April 7th, 2006 01:09 PM
save a PDF file as text file through VB. NET kvenkatu VB.NET 0 April 6th, 2006 12:15 PM
open/ save default.aspx mosad2 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 January 18th, 2005 08:23 AM
how to save & restore default printer settings? Tiffany Pro VB 6 1 April 7th, 2004 06:59 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.