ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to add a sub at the application level open event? (https://www.excelbanter.com/excel-programming/400036-how-add-sub-application-level-open-event.html)

Rich

how to add a sub at the application level open event?
 
Greetings,

How do I add a subroutine at the application level?

Example: When I start up Excel I want to have it bring up a messagebox that
says "test"

I can see in the VB editor how to do this at the workbook level in the
workbook open event. But I need to do this at the application level.

Thanks.
Rich

JW[_2_]

how to add a sub at the application level open event?
 
Have a look at Chip's page regarding Application Level Events.
http://www.cpearson.com/excel/AppEvent.aspx

Rich wrote:
Greetings,

How do I add a subroutine at the application level?

Example: When I start up Excel I want to have it bring up a messagebox that
says "test"

I can see in the VB editor how to do this at the workbook level in the
workbook open event. But I need to do this at the application level.

Thanks.
Rich



Gary''s Student

how to add a sub at the application level open event?
 
Put the workbook open macro in your personal.xls file.
--
Gary''s Student - gsnu200751


"Rich" wrote:

Greetings,

How do I add a subroutine at the application level?

Example: When I start up Excel I want to have it bring up a messagebox that
says "test"

I can see in the VB editor how to do this at the workbook level in the
workbook open event. But I need to do this at the application level.

Thanks.
Rich


Rich

how to add a sub at the application level open event?
 
Already went there. The last time I needed to do something like this was in
Excel 97 and I believe they had an Application level in the Project browser
and then the ThisWorkbook selection for respective workbooks. I have done
this before, but years ago.

If I add code to thisworkbook, won't that only run when I open Thisworkbook?
In need to invoke a sub right when Excel Starts, kind of like the AutoExec
macro or OnStartup in an Access mdb.

May I ask if you could show me a sample, maybe I need to use an xla or
something? A sample of where I would place a simple sub like

Sub TestOpen()
msgbox "test"
End Sub

so that as soon as I click on my Excel icon as excel opens up I get the
"Test" message?

Thanks.

"JW" wrote:

Have a look at Chip's page regarding Application Level Events.
http://www.cpearson.com/excel/AppEvent.aspx

Rich wrote:
Greetings,

How do I add a subroutine at the application level?

Example: When I start up Excel I want to have it bring up a messagebox that
says "test"

I can see in the VB editor how to do this at the workbook level in the
workbook open event. But I need to do this at the application level.

Thanks.
Rich




Rich

how to add a sub at the application level open event?
 
Thanks for that suggestion. So I record an Open workbook macro and then
copy that code to personal.xls?

Wait. I think it is starting to come back to me. In the XLstart folder -
do I put something in there?

What is the personal xls file?

Thanks.

"Gary''s Student" wrote:

Put the workbook open macro in your personal.xls file.
--
Gary''s Student - gsnu200751


"Rich" wrote:

Greetings,

How do I add a subroutine at the application level?

Example: When I start up Excel I want to have it bring up a messagebox that
says "test"

I can see in the VB editor how to do this at the workbook level in the
workbook open event. But I need to do this at the application level.

Thanks.
Rich


Rich

how to add a sub at the application level open event?
 
I figured out your suggestion. I created a new workbook and called it
Personal.xls and saved it to prog...XLstart and added

msgbox "testing"

to the ThisWorkbook.Open event.

Seems to work OK.

Now the real deal is that Excel is being opened by Sql Server Reporting
services. I have set some Reporting Services reports to open as Excel files
from a .Net app I wrote. The problem is that when users print out the Excel
reports -- they are printing out in landscape but need to be in Portrait
layout. I could add a macro button that the users can press before they
print, but I would rather identify the workbook as a reporting services
workbook and set the page layout to portrait seamlessly. I hope I can
identify the workbook on the application startup.


"Gary''s Student" wrote:

Put the workbook open macro in your personal.xls file.
--
Gary''s Student - gsnu200751


"Rich" wrote:

Greetings,

How do I add a subroutine at the application level?

Example: When I start up Excel I want to have it bring up a messagebox that
says "test"

I can see in the VB editor how to do this at the workbook level in the
workbook open event. But I need to do this at the application level.

Thanks.
Rich



All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com