Help with Excel macro

V

Victor Delta

I have an Excel macro which is designed to minimise and then save the
open/active spreadsheet:


Application.WindowState = xlMinimized

ActiveWorkbook.Save


However, when it operates on one particular spreadsheet - "my work.xls" -
between the minimising and saving I would like it to run another macro
called "alter format". Assuming this is possible, can someone help me with
the code to achieve this please?


Many thanks
 
P

p45cal

Victor said:
I have an Excel macro which is designed to minimise and then save the
open/active spreadsheet:


Application.WindowState = xlMinimized

ActiveWorkbook.Save


However, when it operates on one particular spreadsheet - "my work.xls
-
between the minimising and saving I would like it to run another macro
called "alter format". Assuming this is possible, can someone help m
with
the code to achieve this please?


Many thanks

It's unlikely that a macro could be called "alter format", but assumin
it's called "AlterFormat" then this should do it:
Application.WindowState = xlMinimized
AlterFormat
ActiveWorkbook.Sav
 
V

Victor Delta

p45cal said:
It's unlikely that a macro could be called "alter format", but assuming
it's called "AlterFormat" then this should do it:
Application.WindowState = xlMinimized
AlterFormat
ActiveWorkbook.Save

Thanks. Yes, you're right, I should have put "alter_format".

However, I only want to run the macro on one spreadsheet and so assumed some
sort of if statement would be required...? Is this not the case?

V
 
P

p45cal

Victor said:
Thanks. Yes, you're right, I should have put "alter_format".

However, I only want to run the macro on one spreadsheet and so assume
some
sort of if statement would be required...? Is this not the case?

V

Gotcha.
Application.WindowState = xlMinimized
If ActiveWorkbook.Name = "my work.xls" Then AlterFormat
ActiveWorkbook.Sav
 
V

Victor Delta

p45cal said:
Gotcha.
Application.WindowState = xlMinimized
If ActiveWorkbook.Name = "my work.xls" Then AlterFormat
ActiveWorkbook.Save

Many thanks. No "Run" required then?

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top