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 27th, 2005, 01:07 PM
Authorized User
 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default run macro from asp

hi..

i have a form
i accept some user inputs in the form. there is a link on the form from where i open the excel file in the same browser (not in a new page...simply using a href. i am also accepting input from the user in the excel.

now i want to save the data in excel as well as on asp form.
i can save directly thru vba code in excel to the db. but suppose the user comes back to the form and somehow doesnt click the submit button of the asp form to save the data. then it would mean that i saved a certain piece of data in the db thru excel and the other relevant data didnt get saved at all!

so i revised my approach. now what i want is that when i click the submit button on the form i want to save the excel data also.

for this what i am doing is...when i open the excel template i let user enter data inside it and then i will let him a copy of the excel file on his machine(cleint machine). so in the end when the user clicks the submit button i will
1. save the form data in database
2. open the excel file stored in clients machine
3. run a procedure inside it whihc save the data in the db

can i open the excel file on button click on asp form and then run a macro in the excel file?
 
Old January 27th, 2005, 01:53 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can have a workbook_open() event embedded in the workbook object of Excel. I suggest you either use this or maybe the Workbook_BeforeClose event to save the file with a default file name in the root of C:\ on the users harddrive.

cheers

Matthew

 
Old January 27th, 2005, 07:27 PM
Authorized User
 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

basically i am 1st opening an excel file and the savinf a copy of that excel file in clinet machine and then reopen at the end when i click teh button.

so if i write anything in auto_open ot workbook_save then it wil run for boht the book...i want to do so only for the 2nd exel book whihc i save on the clinet ..i hope i am clear
 
Old January 28th, 2005, 04:30 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Beyond me. Sorry.

Matthew






Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to run macro from another workbook? rmilward Excel VBA 2 September 26th, 2009 08:00 PM
How do i run Macro on Web [email protected] Excel VBA 2 April 17th, 2008 01:04 AM
Run code in Macro Corey Access VBA 4 February 5th, 2007 10:54 AM
run a macro at a certain date s_gh Excel VBA 4 May 17th, 2006 06:34 AM
Macro Doesn't Run? CoryKutchera Excel VBA 3 January 5th, 2005 10:30 AM





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