Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 87
Default Workbook open event

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Workbook open event

Hi,

It sounds like you've put the code in the open event in Personal.xls

Alt+F11 to open VB editor then Ctrl+R to open project explorer.

On the left find VBAProject(your workbook name) and your code goes in there.
Double click "This Workbook' in that project and enter your code on the right.
If you have put it in personal.xls then I suggest you remove it.

Mike

"Pawan" wrote:

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 87
Default Workbook open event

I have put it in Thisworkbook under 'Microsoft Excel Onjects' of the
appropriate workbook...

"Mike H" wrote:

Hi,

It sounds like you've put the code in the open event in Personal.xls

Alt+F11 to open VB editor then Ctrl+R to open project explorer.

On the left find VBAProject(your workbook name) and your code goes in there.
Double click "This Workbook' in that project and enter your code on the right.
If you have put it in personal.xls then I suggest you remove it.

Mike

"Pawan" wrote:

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default Workbook open event

If might help if you show your code.
--
HTH,
Barb Reinhardt



"Pawan" wrote:

I have put it in Thisworkbook under 'Microsoft Excel Onjects' of the
appropriate workbook...

"Mike H" wrote:

Hi,

It sounds like you've put the code in the open event in Personal.xls

Alt+F11 to open VB editor then Ctrl+R to open project explorer.

On the left find VBAProject(your workbook name) and your code goes in there.
Double click "This Workbook' in that project and enter your code on the right.
If you have put it in personal.xls then I suggest you remove it.

Mike

"Pawan" wrote:

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 87
Default Workbook open event

The code is:

Private Sub Workbook_Open()

Dim ws As Worksheet

Application.DisplayAlerts = False

For Each ws In Worksheets

If ws.CodeName < "Sheet1" And ws.CodeName < "Sheet2" Then ws.Delete

Next

Application.DisplayAlerts = True


End Sub

"Barb Reinhardt" wrote:

If might help if you show your code.
--
HTH,
Barb Reinhardt



"Pawan" wrote:

I have put it in Thisworkbook under 'Microsoft Excel Onjects' of the
appropriate workbook...

"Mike H" wrote:

Hi,

It sounds like you've put the code in the open event in Personal.xls

Alt+F11 to open VB editor then Ctrl+R to open project explorer.

On the left find VBAProject(your workbook name) and your code goes in there.
Double click "This Workbook' in that project and enter your code on the right.
If you have put it in personal.xls then I suggest you remove it.

Mike

"Pawan" wrote:

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default Workbook open event

It looks like it should work if it's really in the ThisWorkbook module. Try
this, in the Immediate window, type this
Application.EnableEvents = TRUE

Close the workbook and reopen and see if it works now.
--
HTH,
Barb Reinhardt



"Pawan" wrote:

The code is:

Private Sub Workbook_Open()

Dim ws As Worksheet

Application.DisplayAlerts = False

For Each ws In Worksheets

If ws.CodeName < "Sheet1" And ws.CodeName < "Sheet2" Then ws.Delete

Next

Application.DisplayAlerts = True


End Sub

"Barb Reinhardt" wrote:

If might help if you show your code.
--
HTH,
Barb Reinhardt



"Pawan" wrote:

I have put it in Thisworkbook under 'Microsoft Excel Onjects' of the
appropriate workbook...

"Mike H" wrote:

Hi,

It sounds like you've put the code in the open event in Personal.xls

Alt+F11 to open VB editor then Ctrl+R to open project explorer.

On the left find VBAProject(your workbook name) and your code goes in there.
Double click "This Workbook' in that project and enter your code on the right.
If you have put it in personal.xls then I suggest you remove it.

Mike

"Pawan" wrote:

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default Workbook open event

Oops, I just noticed something

Private Sub Workbook_Open()

Dim ws As Worksheet

Application.DisplayAlerts = False

For Each ws In ThisWorkbook.Worksheets 'Changed this line

If ws.CodeName < "Sheet1" And ws.CodeName < "Sheet2" Then ws.Delete

Next

Application.DisplayAlerts = True


End Sub

--
HTH,
Barb Reinhardt



"Pawan" wrote:

The code is:

Private Sub Workbook_Open()

Dim ws As Worksheet

Application.DisplayAlerts = False

For Each ws In Worksheets

If ws.CodeName < "Sheet1" And ws.CodeName < "Sheet2" Then ws.Delete

Next

Application.DisplayAlerts = True


End Sub

"Barb Reinhardt" wrote:

If might help if you show your code.
--
HTH,
Barb Reinhardt



"Pawan" wrote:

I have put it in Thisworkbook under 'Microsoft Excel Onjects' of the
appropriate workbook...

"Mike H" wrote:

Hi,

It sounds like you've put the code in the open event in Personal.xls

Alt+F11 to open VB editor then Ctrl+R to open project explorer.

On the left find VBAProject(your workbook name) and your code goes in there.
Double click "This Workbook' in that project and enter your code on the right.
If you have put it in personal.xls then I suggest you remove it.

Mike

"Pawan" wrote:

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 87
Default Workbook open event

It still doesnt work.. :(

"Barb Reinhardt" wrote:

Oops, I just noticed something

Private Sub Workbook_Open()

Dim ws As Worksheet

Application.DisplayAlerts = False

For Each ws In ThisWorkbook.Worksheets 'Changed this line

If ws.CodeName < "Sheet1" And ws.CodeName < "Sheet2" Then ws.Delete

Next

Application.DisplayAlerts = True


End Sub

--
HTH,
Barb Reinhardt



"Pawan" wrote:

The code is:

Private Sub Workbook_Open()

Dim ws As Worksheet

Application.DisplayAlerts = False

For Each ws In Worksheets

If ws.CodeName < "Sheet1" And ws.CodeName < "Sheet2" Then ws.Delete

Next

Application.DisplayAlerts = True


End Sub

"Barb Reinhardt" wrote:

If might help if you show your code.
--
HTH,
Barb Reinhardt



"Pawan" wrote:

I have put it in Thisworkbook under 'Microsoft Excel Onjects' of the
appropriate workbook...

"Mike H" wrote:

Hi,

It sounds like you've put the code in the open event in Personal.xls

Alt+F11 to open VB editor then Ctrl+R to open project explorer.

On the left find VBAProject(your workbook name) and your code goes in there.
Double click "This Workbook' in that project and enter your code on the right.
If you have put it in personal.xls then I suggest you remove it.

Mike

"Pawan" wrote:

Hi

I have written a code in workbook open event. But it works only if I closes
excel and reopens the file. If I close that particular workbook (without
closing excel) and reopens, then that code doesnt execute. Is it normal
behavior? Is there any way to make the code work whenever that workbook
reopens?

Pawan

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
work book open _ event Hassan Excel Worksheet Functions 1 July 3rd 08 12:49 PM
App_change event to open all work book [email protected] Excel Discussion (Misc queries) 1 August 2nd 07 03:52 PM
What code do I use to attach event handler that will open my user. TeresaManley Excel Worksheet Functions 2 May 5th 07 09:55 PM
Macro doesn't work when used as Workbook Open event Phil Excel Discussion (Misc queries) 2 October 20th 06 02:42 PM
Event: open workbook Jeff Excel Discussion (Misc queries) 1 September 28th 06 02:58 PM


All times are GMT +1. The time now is 01:50 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"