Macro to open report, and run the macro inside the report.

help_questions

Board Regular
Joined
Aug 22, 2005
Messages
215
I have a report, titled Report.xls; in Report.xls is a macro that is titled "Run()".
What I need is a macro that will open Report.xls and then execute "Run()".
How would I write this code?
Thanks in advance
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,963
Re: Macro to open report, and run the macro inside the repor

What I need is a macro that will open Report.xls and then execute "Run()

What program are you using to open Report.xls?

In order for a macro to run automatically, the document either needs to be already open, told to open from another program


Code:
Private Sub Workbook_open()

  Run

End Sub
 

help_questions

Board Regular
Joined
Aug 22, 2005
Messages
215
I want to use another excel workbook and have macro that's commands will tell excel to open report.xls.

Then i want another line of code to run "RUN()".

I dont want to use workbook_open(but thanks for this solution)

Any other ideas
 

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,963
You could use this to open your report.xls

Application.ScreenUpdating = False
ChDir "\\hqnas01p\cac$\Management\Customer Relations\Complaint Log"
Workbooks.Open Filename:= _
"\\hqnas01p\cac$\Management\Customer Relations\Complaint Log\Complaint Log 2006.xls"
Application.ScreenUpdating = True

(Above on button)

Replace '\\hqnas01p\cac$' with 'p:\\type filepath here (eg)

Then have my above suggestion in the workbook_open event of the report.xls workbook

Mark
 

help_questions

Board Regular
Joined
Aug 22, 2005
Messages
215
Re: Macro to open report, and run the macro inside the repor

I have a report, titled Report.xls; in Report.xls is a macro that is titled "Run()".
What I need is a macro that will open Report.xls and then execute "Run()".
How would I write this code?
Thanks in advance


Any other solutions to achieve my goal? The suggestion works, but i want a solution that does not use workbook_open.....
 

Forum statistics

Threads
1,144,394
Messages
5,724,084
Members
422,536
Latest member
Zeeshan53

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top