Workbook_open Not Firing

Jun 26, 2007

I am using the following code in my Workbook_Open sub, located in the ThisWorkbook code module. I am enabling macros when opening. All other VBA code in the project is running correctly.

Private Sub Workbook_Open()
Worksheets("Sheet1").init
MsgBox "starting"
End Sub

The init sub did not appear to be running so I inserted the MsgBox to confirm, but that doesn't come up either.

View 6 Replies


ADVERTISEMENT

Workbook_open() To Every Workbook

Jun 4, 2008

I want to use this command when I open every workbook.

How do I do that? I know you're supposed to put the macro in the thisworkbook module in the workbook, but I have 600 workbooks that needs to be changed. That is just not a good idea. I've tried to put the macro in the workbook called own.xls (I use a swedish version of excel, dont know what it is called in english) thisworkbook,

View 9 Replies View Related

Workbook_open Yes/No Popup

Nov 18, 2009

I script that on open would pop up asking if a sync was done with an option for yes or no. If yes is pressed then it would just open, if no selected it would give a message "must sync before use" and close the workbook.

I do not want this message to pop up when other spreadsheets are open when this one is still open so im guessing private workbook_open

View 9 Replies View Related

Workbook_Open() In Separate File

Oct 14, 2008

I have an Excel add-in file (stored .xla format) that is used by a lot of other spreadsheets on a network location because it is modified often, and all workbooks made from a template reference it. everything with that works fine, and any changes made to the add-in file are always reflected upon startup in the workbooks. So there isn't a problem with that. Recently I've had to add a Workbook_Open() sub into this add-in (which I wrote in 'ThisWorkbook'). However, this macro is never entered by any of the workbooks. Is it possible to have a workbook_open sub in another file? If so, what can be causing it to fail (there aren't any errors or anything like that in the sub)?

View 4 Replies View Related

Workbook_Open Doesn't Run On Second Open

Dec 29, 2009

I have noticed this on more than one workbook with an Workbook_Open macro. When you open Excel, open Workbook1, do some work , save or don't save and close, then reOpen Workbook1 without having closed the Excel application, the Workbook_Open macro in Workbook1 doesn't run.

Closing Excel and reopening Workbook1 initiates the Workbook_Open macro. It's as if Excel remembers having previously opened Workbook1 and so it doesn't rerun the Workbook_Open macro the next time you open it.

View 3 Replies View Related

Opening Userform With Workbook_Open Sub

Dec 9, 2008

I have 3 userforms:
COS
COSP
SLevel
and I have the code

Private Sub Workbook_Open()
COS.Show
End Sub

View 9 Replies View Related

Workbook_open Runs On Closing

Feb 16, 2007

I've a problem with the below code.

Option Explicit

Private Sub Workbook_Open()
Dim x As Date
x = InputBox("Enter End Date!")
Range("B2") = x
With Application. CommandBars("File")
.Controls("Save").Enabled = False
.Controls("Save").Visible = False
.Controls("Save As...").Enabled = False
.Controls("Save As...").Visible = False
End With
With Application.CommandBars("Standard")
.Controls("Save").Enabled = False .................

View 9 Replies View Related

Disable Workbook_open From Another Macro

Jun 14, 2007

from 1 sheet i am opening several other worksheets and read in the bits i want.
i am finding that on occasions the workbook_open on these sheets is causing great performance issues because of the calc mode set to automatic in the open routine of the individual sheets. i dont need it to be set to auto but the sheet owners perfer it to be set like this and i cant turn it off their sheets. is ther a way of opening a workbook from a macro and then override its workbook_open routine?

Set wb = Workbooks.Open(sSourceFolder & "" & "mySheet.xls", False, True)

i cant find any other switches that i could use to disable this.

View 2 Replies View Related

Private Sub Workbook_Open() Doesn't Execute

Feb 25, 2008

why the code below might not execute ? It just seems like it skips over the code and doesn't run at all.

Private Sub Workbook_Open()
'AssignRequestNumber()
MsgBox ("Whoa")
Run "AssignTrackNumber"

End Sub

I have a macro assigning a unique number to the file in a fixed cell whenever the .xlt file is opened from File-New.

View 9 Replies View Related

Disable/skip Workbook_open Function

Apr 20, 2006

i have a workbook iam using as a template.(workbook "template") the user opens which then requests a job number which will then saves the workbook as the enterd job number. this workbook also contains all the material data. eg: price and type which is on sheet "data". I am hopin to get to the sheet "data" from another workbooks command button by bypassing the job enter request by the workbook_open sub. basically i need some code that disables a workbook_open sub

View 8 Replies View Related

Kill And Insert Event In Workbook_open

Sep 22, 2006

Private Sub Workbook_Open()
If ActiveWorkbook. Name = "UserA.xls" Then
Call PreviewList
Else
Cancel = True
End If
End Sub

After the macro auto-startup, UserA works on the worksheet and input some procedures and save as ClientA.xls. However, before save as ClientA.xls and close, UserA wants to change the worksheet name and Procedure name as below, how to do that?

Private Sub Workbook_Open()
If ActiveWorkbook.Name = "ClientA.xls" Then
Call RevisedList
Else
Cancel = True
End If
End Sub

View 2 Replies View Related

Global Static Variables On Workbook_open

Jan 20, 2007

problems with Global Static Variables.

In the Workook_open Sub I want to define 2 global static Variables.
For some reason I can't get it to work.
Whenever I try to access these vars they have the value "0"
I use Excel 2000.

Here is what i did:

Dim i As Integer
Dim ws As Worksheet
Public Static GlobalStartX As Integer
Public Static GlobalStartY As Integer

Private Sub Workbook_Open()

GlobalStartX = 6
GlobalStartY = 21

End Sub

View 4 Replies View Related

Multiple OnTime In Workbook_Open Event

Dec 6, 2007

the following workbook open event which repeats a macro called "Refresh" every 30 minutes. However, there is another macro "tame_blph" that i wanna call at 12 midnight everyday.

Private Sub Workbook_Open()

Call tame_blph

NextTick = Now + TimeValue("00:30:00")

Application .OnTime NextTick, "Refresh", , True

End Sub

Is it even possible to have multiple Workbook open events and/or multiple NextTick or something?

View 3 Replies View Related

Both 'Private Sub Workbook_Open' And 'Auto Open' Run Sequentially

Aug 1, 2009

I have built a complex vba & multisheet spreadsheet that I am looking to secure against all the common attacks. So I have:A Workbook Open pw;
VBA password (29 symbols/numbers/Caps/lower case)
Very Hidden worksheets
Hidden rows/columns
Restricted scroll areas
Workbook protection
Code that auto protects all sheets upon opening
Registry referencing in Workbook Open with timed closure if not matched
Now I am on the last leg of implementing protection against Application.EnableEvents = False; force enabling of Macros and hiding of toolbars, scrollbars etc... Phew.

Soooo, in my research, I have learnt that if EnableEvents = False, Workbook_Open is essentially skipped and the security VBA routines are disabled. To get around, I have copied the entire contents of the Workbook_Open routine to a module under Auto_Open. The first line of both these scripts is: Application.EnableEvents = True.

Works! So far so good.
However, I have a Msgbox prompt in the scripts that displays twice. So in essence, Excel is running Workbook Open first, then Auto Open second.
If I open another instance of Excel and run Application.EnableEvents = False first before opening my spreadsheet, I only get one message. So only the Auto Open script runs.

View 9 Replies View Related

Worksheet_Activate Not Firing

Feb 10, 2010

I have a workbook that contains several worksheets. One particular worksheet is a main page with buttons that open up the other worksheets for the user to view specific data. To minimize the open worksheets I have tried to institute a worksheet activate so that when the user selects this main page tab all other worksheets hide. It works well, for most of the sheets. However, for some reason a few sheets will not hide. Ive tried several different codes to get these particular sheets to close to no avail. Ive tried calling each sheet individually to hide the sheet, and Ive tried to hide all sheets together. Codes Ive used are below. Again, both codes work fine but only on some sheets. How can I get the Activate call to work for all sheets? Anyone ever have this issue? The particular sheets Im having a hard time with are in red in 2nd code.

Codes Ive used: ..............

View 14 Replies View Related

Show User Form After Workbook_open Code Has Executed

Apr 19, 2006

i have this code which askes the user for a job number once the workbook is opened.

Private Sub Workbook_open()

' If sheet was named by original open routine, exit

If ActiveSheet.Name = "Main Roof" Then Exit Sub

' otherwise

Do
Returnvalue = InputBox("Please Enter a New Job Number.", "Information")

' Allow changes by entering q as the Job Number
If Returnvalue = "q" Then Exit Sub


' Delete the ' from the front of the following two lines and
' then when you enter q as the Job Number you will also be
' asked for a password. The default password is toe.

what iam trying to do is get it to open the userform "WorkSelection" after it has completed the above code.

View 3 Replies View Related

Hide/delete/visble=false Userform From Workbook_open Sub

Apr 21, 2006

i have been trying to hide the userform from the workbook open event with no luck

Private Sub Workbook_Open()
ufmTheEstimator.Show
Dim Worksheet As Excel.Worksheet
If Me.Worksheets("Main Roof"). Name = True Then
ufmTheEstimator.Hide
End If
End Sub

View 4 Replies View Related

Worksheet_Change Event Not Firing

Nov 2, 2008

Bit of an odd one, but I'm sure it's probably happened before to others. I've just been sent a worksheet to redesign (an audit template) one which I'll be making use of data validation lists (Yes, No, N/A) a fair bit.

What I want to happen is that when the user selects from a list, I'll fire a Worksheet_Change event, which will then run some background calculations to set up the next questions, etc. Problem is, the event isn't firing at all. I'm using the following to test the event...

View 2 Replies View Related

Worksheet_Change Event Not Firing ...

Jan 16, 2008

I wrote a simple script to show/hide certain rows based on the value of a certain cell on my worksheet (cell value chosen by drop down). When I left work last night, everything worked fine. When I returned this morning, the change event no longer appears to be firing. I'm quite certain no one else accessed the file to change the coding, so my only guesses are 1)perhaps some sort of system update was applied in the middle of the night and it messed with something or 2) aliens have blocked our technology in advance of their invasion.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next

If Target.Address = "F1" Then

Application.EnableEvents = False

Select Case Target
Case "150"
Rows("13").EntireRow.Hidden = False
Rows("14:19").EntireRow.Hidden = True
Case "330"
Rows("14").EntireRow.Hidden = False
Rows("13").EntireRow.Hidden = True
Rows("15:19").EntireRow.Hidden = True
Case "340"
Rows("15:19").EntireRow.Hidden = False
Rows("13:14").EntireRow.Hidden = True
Case Else
Rows("13:19").EntireRow.Hidden = True
End Select

Application.EnableEvents = True

End If
End Sub

View 9 Replies View Related

Event Code Firing More Than Once

Nov 2, 2006

i try with what limited knowledge i have, if you dont mind take a look at the code below, i read your article and added the appropriate line, the code works fine except the msgbox has to be ok'd twice before it exits sub any ideas why?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Dim MyCell
Set rng = Range("A2:A100")
If Not Intersect(Target, rng) Is Nothing Then
With rng
For Each MyCell In rng
If MyCell = "" Then
MyCell.Select
MsgBox "Please use this next blank cell"
Exit Sub

End If
Next
End With
End If
End Sub

View 2 Replies View Related

Uninstall Addin Without Firing The Events In It

Sep 23, 2006

I want to uninstall an addin from another addin. The problem arises when the addin i want to uninstall contains events similar like auto_open and workbook_addininstall
It seems that they get triggered even when i close the addin That way i loose controll over the programsequence. And that is the thing i don't want. If someone has a solution, that would be great. Otherwise i have to reorganize everything and merge two addins in to one And i really don't like all the extra work

View 2 Replies View Related

OnTime Not Firing Via Scheduled Tasks

Dec 27, 2006

I scheduled a task to open excel and when it does (at a certain time), a little sub is supposed to run (couple minutes later) via the OnTime Method located in the Workbook Open Event. There is one weird thing though....

1. When Excel opens automatically through Scheduled Task (and you see the clean white sheet WITH gridlines), Sub does NOT run (that is, my file is NOT even opening).

2. When I myself open Excel manually WITHOUT opening a new workbook (in other words, in front of you there will be grey area without gridlines), Sub runs perfectly (in other words, my file opens automatically and Sub performs whatever it is supposed to do).

View 7 Replies View Related

Worksheet Change Event Not Firing

Aug 22, 2007

I have a spreadsheet with a table of values in range E5 to T158.

A macro populates the table by looking up values on other sheets in the book. If the macro finds a value in the lookup for Row 7 of any column (ie E7,F7...T7) it populates the rest of the column with that value (E7 value gets pasted to E8:E158) THEN it protects the cells it pasted (E8:E158).

If the macro does NOT find a value for row 7, it simply skips it, leaving it blank, and continues to row 8 until it reaches row 158 of each column E to T.

I want to give the user flexibility with these values. So if the user either deletes E7 or changes the value of the contents in E7, I want to unprotect the cells of rows 8 to 158 for that column.

I have created a

Private Sub Worksheet_Change(ByVal Target As Range)

in the private module for that sheet below. I thought it was working but it isn't doing anything when I change or delete the value in Cell E7 for example. Please help!

Private Sub Worksheet_Change(ByVal Target As Range)

'Do nothing if more than one cell is changed
If Target.Cells.count > 1 Then Exit Sub 'Or IsEmpty(Target)

View 5 Replies View Related

Change Event Code Not Firing

Sep 27, 2007

I ran this code last week and it worked great, but today it doesn't work at all. I have even deleted it, closed Excel and and started fresh. Is there some small thing I'm missing (like hopping on my left foot while entering a code) ...

View 7 Replies View Related

Workbook Activate Event Not Firing

Mar 19, 2008

button on main workbook opens 2 other workbooks and assigns a workbook object to them. the 2 opened workbooks are Activated in turn, range values changed and macros on these sheets invoked and results captured and pasted back onto the starter workbook. the macro is within a sub in a module as are the ones in the second workbook. An example of the code used is:

Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic

Dim wkbTest As Workbook
Set wkbTest = Workbooks("Test.xls")
wkbTest.Activate
Sheets("G").Activate
Range("Today").Value = Format(Now(), "dd-mmm-yy")
Application.Run "'" & wkbTest.Name & "'" & "!TestMacro" ............

View 5 Replies View Related

Prevent VBA Macro Firing Event Code

Nov 23, 2009

I'd like to know if there is a change event that only occurs when a target cell is changed by the user, but does not occur when i'ts changed by a macro. nfortunately, the Worksheet_Change event occurs in both cases.

View 2 Replies View Related

Stop Controls Change Event Firing

Nov 6, 2006

I want to be able to reset the value in a combobox, but without the combobox executing code, when it resets. Is there any way of doing this?

I have tried the code below but the ComboBox still executes when its value is changed.

Sub Reset_combobox()
Worksheets("Sheet1").ComboBox1.Enabled = False
Worksheets("Sheet1").ComboBox1.Value = 1
Worksheets("Sheet1").ComboBox1.Enabled = True
End Sub

The workbook containing the above is attached.

View 7 Replies View Related

Stop Code Firing On Selection Change

Nov 22, 2006

how I can disable an InputBox? I've got some code that whenever someone selects a cell in a specified range, an input box pops up (running a macro) - this can get annoying sometimes though if just browsing. Does anyone know a macro where I can "disable" this?

View 4 Replies View Related

Prevent Control Event Procedures Firing

Apr 27, 2008

I have CheckBox1 (.Value = FALSE) on the UserForm and when I run my sript ... this change Value to TRUE and run the subrutine Private Sub CheckBox1_Click. I need block this step with using VBA code.

View 4 Replies View Related

Sheet & Workbook Event Code Not Firing

Jun 27, 2008

why this code does not work when the worksheet is changed between range "B1:F5"?

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("B1:F5")) Is Nothing Then
With Range("B1:F5")
Cells(Target.Row, 7) = Cells(Target.Row, 6).Value + Cells(Target.Row, 5).Value
End With
End If
End Sub

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved