Wrox Programmer Forums
|
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
 
Old January 15th, 2008, 10:00 AM
Registered User
 
Join Date: Jan 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Saving with Excel VBA

I need to write a code that will download a specific file from a database to the user's hard drive. The code so far has the destination folder hardcoded but I would like to use the save as dialog box so the user can select a location to download to.

I've never messed with user forms before, can anyone help me?

Thanks,
Scott

Scott Waters
 
Old January 15th, 2008, 10:33 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi Scooter

Here is the code in Excel VBA

Code:
Sub PromptSaveAs()

Dim oWB As Workbook
Set oWB = ActiveWorkbook
Ret = Application.GetSaveAsFilename(InitialFilename:="c:\", fileFilter:="Excel File (*.xls), *.xls")
oWB.SaveAs Ret


End Sub
If you are doing it in Visual Basic 6.0 or VS2005 etc, you need to add reference to Excel Object library

Cheers
Shasur

http://www.dotnetdud.blogspot.com

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving HTML popups using VBA in MS Excel Sureshsbe VB How-To 0 June 16th, 2007 02:40 AM
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
Saving an excel file in Access VBA theboylatham Access VBA 1 August 19th, 2005 08:14 AM
EXCEL question saving a file saving the the first macupryk VS.NET 2002/2003 0 January 6th, 2005 05:33 PM
Saving Excel VBA code gives problems - Help needed mjaitly Excel VBA 0 April 14th, 2004 07:23 AM





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