Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Limitations of auto-open (xlstart) macro

I'm currently working with excel in combination with a special security
program called eInfotree. The security-shell provides security-audits etc
which are required due to regulations applicable in our industry. Now, when
we use an autofilter in excel, and close the excel-file whith the filter on
(meaning only a limited number of fields displayed) the file in combination
with the security causes the file to become corrupt.

We know it is an option to include a VBA-macro inside each excel-file, which
resets the autofilter before closing it, but since we don't want to touch all
the inidivudal files, we were looking into the option to include such a macro
in the xlstart-macro.
So the question; is it possible to create a macro on application level
(independent of each loaded workbook) that can trigger certain actions when
closing an individual workbook? In this case we want it to reset the
autofilter before closing the file.

Any feedback is welcomed.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Limitations of auto-open (xlstart) macro

Public WithEvents App As Application

Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean)
On Error Resume Next
Wb.Worksheets(1).AutoFilter
On Error GoTo 0
End Sub

Private Sub Workbook_Open()
Set App = Application
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tygox1" wrote in message
...
I'm currently working with excel in combination with a special security
program called eInfotree. The security-shell provides security-audits etc
which are required due to regulations applicable in our industry. Now,

when
we use an autofilter in excel, and close the excel-file whith the filter

on
(meaning only a limited number of fields displayed) the file in

combination
with the security causes the file to become corrupt.

We know it is an option to include a VBA-macro inside each excel-file,

which
resets the autofilter before closing it, but since we don't want to touch

all
the inidivudal files, we were looking into the option to include such a

macro
in the xlstart-macro.
So the question; is it possible to create a macro on application level
(independent of each loaded workbook) that can trigger certain actions

when
closing an individual workbook? In this case we want it to reset the
autofilter before closing the file.

Any feedback is welcomed.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Limitations of auto-open (xlstart) macro

Bob,

thank you for this reply.
Unfortunately it does not seems to work. Did you foresee to include this
code in each individual sheet, or in the auto-open one?

Regards,
Tim

"Bob Phillips" wrote:

Public WithEvents App As Application

Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean)
On Error Resume Next
Wb.Worksheets(1).AutoFilter
On Error GoTo 0
End Sub

Private Sub Workbook_Open()
Set App = Application
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tygox1" wrote in message
...
I'm currently working with excel in combination with a special security
program called eInfotree. The security-shell provides security-audits etc
which are required due to regulations applicable in our industry. Now,

when
we use an autofilter in excel, and close the excel-file whith the filter

on
(meaning only a limited number of fields displayed) the file in

combination
with the security causes the file to become corrupt.

We know it is an option to include a VBA-macro inside each excel-file,

which
resets the autofilter before closing it, but since we don't want to touch

all
the inidivudal files, we were looking into the option to include such a

macro
in the xlstart-macro.
So the question; is it possible to create a macro on application level
(independent of each loaded workbook) that can trigger certain actions

when
closing an individual workbook? In this case we want it to reset the
autofilter before closing the file.

Any feedback is welcomed.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Limitations of auto-open (xlstart) macro

Combine Bob's code with the guidelines here :
http://www.cpearson.com/excel/AppEvent.htm

NickHK

"Tygox1" wrote in message
...
Bob,

thank you for this reply.
Unfortunately it does not seems to work. Did you foresee to include this
code in each individual sheet, or in the auto-open one?

Regards,
Tim

"Bob Phillips" wrote:

Public WithEvents App As Application

Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As

Boolean)
On Error Resume Next
Wb.Worksheets(1).AutoFilter
On Error GoTo 0
End Sub

Private Sub Workbook_Open()
Set App = Application
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code




--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Tygox1" wrote in message
...
I'm currently working with excel in combination with a special

security
program called eInfotree. The security-shell provides security-audits

etc
which are required due to regulations applicable in our industry.

Now,
when
we use an autofilter in excel, and close the excel-file whith the

filter
on
(meaning only a limited number of fields displayed) the file in

combination
with the security causes the file to become corrupt.

We know it is an option to include a VBA-macro inside each excel-file,

which
resets the autofilter before closing it, but since we don't want to

touch
all
the inidivudal files, we were looking into the option to include such

a
macro
in the xlstart-macro.
So the question; is it possible to create a macro on application level
(independent of each loaded workbook) that can trigger certain actions

when
closing an individual workbook? In this case we want it to reset the
autofilter before closing the file.

Any feedback is welcomed.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
size limitations on auto filter jeo1 Excel Discussion (Misc queries) 2 April 7th 06 02:43 PM
XLSTART doesn't open PMW DB Excel Worksheet Functions 1 December 15th 05 07:07 PM
XLSTART doesn't open PMW DB Excel Programming 1 December 15th 05 05:23 PM
Auto Open Macro Kasey Kern Excel Programming 3 November 30th 05 08:30 PM
open up an excel program with an auto open macro [email protected] Excel Programming 2 July 17th 05 04:48 PM


All times are GMT +1. The time now is 05:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"