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 19th, 2008, 03:06 PM
Registered User
 
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Saving Form Contents

I have a form wiht textboxes and comboboxes for inputing data... at present... when I need to save I have to close the form and go to File>Save As in excel to save the updated content...

If I choose to put a command button on the form for saving information....can it be coded to do the saving....

Grateful if you could help....
 
Old January 19th, 2008, 10:16 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

You can write a small code in the command button click event

Code:
Private Sub cmdSave_Click()

    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs "c:\temp.xls"

    ActiveWorkbook.Close (False)
    Application.DisplayAlerts = True

End Sub
Hope it works!

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old January 20th, 2008, 12:55 PM
Registered User
 
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried it ... it seems the code is not working...may be I am doing something wrong...

I pasted it in the Save AS command button and after running the application the application closed without saving...

Is there an alternative...or if possible to elaborate:)...Thanks..A. Borhani





Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving data using form misskaos Classic ASP Basics 3 October 27th, 2006 03:16 PM
Saving Form Data Earl Hickey ASP.NET 1.0 and 1.1 Basics 5 July 25th, 2006 01:10 PM
Create and Save ASP form Contents to Word Document abhisheksud Classic ASP Professional 1 October 13th, 2005 04:00 AM
Close form without saving cqprod27 Access VBA 8 June 4th, 2004 08:14 AM





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