Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SK SK is offline
external usenet poster
 
Posts: 1
Default WorkbookOpen code not executing properly

I have a workbook with a workbook open code as follows :

Private Sub Workbook_Open()
Worksheets("instructions").Activate
Worksheets("instructions").Range("B14").Select
Application.ScreenUpdating = True
If Worksheets("instructions").Range("B14").Value = "" Then
Selection = InputBox("Enter your employee Number!")
Worksheets("instructions").Range("e14").Select
MsgBox "Please note that your Functional Centre is : " &
ThisWorkbook.Worksheets("EE Details Revised").Range("h1").Value ", _
vbOKOnly, "Important information."
Else
Worksheets("Form").Activate
Worksheets("Form").Range("A8").Select
End If
End Sub

Another code in THIS WORKBOOK pane is

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Application.EnableEvents = False
SaveItAs
Application.EnableEvents = True
Cancel = True
End Sub

This calls for a SAVEITAS code which is in Module 1. The SAVEITAS code
has a msgbox for saving with YES,NO,CANCEL.
Yes-it saves the file, No closes without saving and cancel doesnt do
anything.

The problem:
On clicking Yes or cancel, it works fine, but when NO is clicked, the
file closes but when it is opened up next time, it should execute the
workbook open code which it doesnt and therefore does not display the
input box as required by Open code. However, if I exit out of Excel
completely and come back to open the file, then workbook open code
executes.

Any idea why it happens this way. Is there a solution to this problem?

Any help will be greatly appreciated.

Regards
SK

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
(trying again...) code stops executing Mark Kubicki Excel Programming 0 December 4th 03 02:00 PM
VBA code stops executing Mark Kubicki Excel Programming 0 December 3rd 03 06:47 PM
Code Changes Not Executing Justin[_8_] Excel Programming 1 October 24th 03 02:31 AM
Excel VBA code executing a variable as a Sub. John Dempsey Excel Programming 3 October 3rd 03 10:34 AM
executing code when a module opens max Excel Programming 0 July 8th 03 07:37 PM


All times are GMT +1. The time now is 11:20 AM.

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"