PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?UmljaA==?=
Guest
Posts: n/a
 
      25th Oct 2007
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
 
Reply With Quote
 
 
 
 
JW
Guest
Posts: n/a
 
      25th Oct 2007
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


 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      25th Oct 2007
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

 
Reply With Quote
 
=?Utf-8?B?UmljaA==?=
Guest
Posts: n/a
 
      25th Oct 2007
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

>
>

 
Reply With Quote
 
=?Utf-8?B?UmljaA==?=
Guest
Posts: n/a
 
      25th Oct 2007
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

 
Reply With Quote
 
=?Utf-8?B?UmljaA==?=
Guest
Posts: n/a
 
      25th Oct 2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Application level event help Jim Thomlinson Microsoft Excel Misc 1 15th Jan 2008 10:30 PM
Application level event help John Bundy Microsoft Excel Misc 0 15th Jan 2008 08:57 PM
Application Level Close Event Ronald Dodge Microsoft Access VBA Modules 7 10th Sep 2007 08:20 PM
.xlA FILE AND WorkbookBeforePrint APPLICATION-LEVEL EVENT Chuckles123 Microsoft Excel Programming 1 22nd Nov 2004 08:41 PM
Monitoring application-level event problem R Avery Microsoft Excel Programming 2 6th Jan 2004 01:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:43 AM.