Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Is it possible to call some of subroutines I created through Excel "Save/Save As" Function

Posted on 2014-01-03
1
253 Views
Last Modified: 2014-01-03
In Excel, when users click "Save" or "Save As" from Toolbar, I like to run some of subroutines I created.  How to do it?  Thanks!
0
Comment
Question by:jjxia2001
1 Comment
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
ID: 39755393
Only from the Excel file you created, where you inserted this code:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    MsgBox "test"
'(add more of your own code here)

End Sub

Open in new window


It won't work if they create a new file by themselves.
Also, it will run no matter if they save the file or not. The code runs, THEN they get the save/save as file dialog where they still can press cancel.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question