workbook_open

  1. AccessShell

    Code behind excel form help

    NOTE: Originally posed elsewhere. I do not believe I will get an answer. I hope I can post it here. I have written some code in Sub Workbook_Open. It works fine. However, I am trying to do two more things. 1. I don't know if I should use Workbook_BeforeClose, Workbook_Deactivate, or...
  2. M

    Excel workbook automatically restores after opening

    I have a workbook that, among other things, minimizes on opening using the VBA command, Application.WindowState = xlMinimizes, in the Workbook_Open macro. This worked for years until recently when it began to restore the workbook window to its last size. The restore happens the moment the...
  3. C

    Workbook_Open() - Call - Call subroutine but does not return

    I am no genius with VB, however I was quite happy with myself when I created a workbook and added under Workbook_Open() four sub-routine's by simply using Call Macro1(), Cal Macro2(), etc. However in my current project file under Workbook_Open(), I start with: Private Sub Workbook_Open Dim...
  4. B

    Code not executing

    Hi all, I use this code to filter data in my workbook; Private Sub Workbook_Open()On Error GoTo Errorhandler Workbooks("Persnlk.xls").Close SaveChanges:=False Workbooks("VB_Macros.xls").Close SaveChanges:=False Worksheets("Shifts").AutoFilterMode = False Worksheets("Shifts").Range("J1:Q" &...
  5. T

    Workbook_Open event won't fire when another window is active

    I've been googling this issue a lot without finding a solution. I have a code in the Workbook_Open event that runs normally when I double click my excel file and wait till it's open. But if I double click hte file and then activate another window (i.e. my internet browser or a file folder)...
  6. rediffusion

    Workbook_Open - how to combine one and more codes?

    Hi all! I duplicate this question because сouldn't find a solution. :( Cross-post is here. :warning: I have in <code style="margin: 0px; padding: 1px 5px; border: 0px; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-stretch: inherit; line-height: inherit; font-family...
  7. P

    Open Referenced Workbook

    I have an Excel Project (Videos.xlsm - project name: videos) which references another Workbook (Series.xlsm - project name: Series). What I would like to do, is open the workbook if its not already open. Is there a way to do it without manually referencing paths or filenames? I already have a...
  8. M

    How to have worksheet_change(byval target by range) to run with workbook_open

    I want to be able to have a workbook do a function when opened. So I want to have a targeted column in a sheet, if a date is 90 days prior to the current date, it will automatically delete the section associated with that date. Example - if today is 4/23/19 and a previous input in a sheet is...
  9. J

    Search specific range for date

    I have a pretty simple request, but getting an error with the range. When the workbook is open, I want to search a specific range ("c2:c15") for any date starting with today and 60 days in the future and popup a msgbox. Below is what I have. Private Sub Workbook_Open() If...
  10. T

    Randomize function

    Following from Rick Rothstein's comment here: https://www.mrexcel.com/forum/excel-questions/747715-rnd-not-truly-random.html he suggests, if I understood him correctly, that you should only ever have the randomize function once. In that case, why not just put it in the Workbook_Open...
  11. G

    Error in WorkBook_Open code: Activate method of Worksheet class failed

    Hi Falks, I have written a code in workbook module in a file with Workbook_Open activity and I am receiving the below error while I am opening the file from sent email or sometimes from main file. Can anyone help me to resolve the below error...
  12. N

    Expanding and collapsing subtotal groups in a protected spreadsheet

    I have a protected spreadsheet (without password) that has subtotals and the associated group levels. These cannot be expanded or collapsed when the sheet is protected. I have found threads that deal with this and advise the following solution: In the code for the sheet, put the following...
  13. D

    Workbook_Open operates inconsistently

    Hello - I have a simple Workbook_Open macro (in the ThisWorkbook module) as follows: Private Sub Workbook_Open() ' Ensure that calculations and screen updating are ON Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True ' Leave workbook in working state...
  14. P

    Workbook_Open Issues

    Hi, I want to run two operations through the Workbook_Open string at the same time but can't get it to work correctly. I currently have; Private Sub Workbook_Open() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Visible = xlSheetVisible Next ws Sheets("START").Visible =...
  15. M

    Possible to have a UserForm close by itself?

    For my workbook, I want a 'splash screen' to display immediately after the workbook has been opened. The workbook takes a 10-12 seconds to run a bunch of code when it is first opened, so I want to inform the user that the workbook is loading, so they don't think something is wrong. I created a...
  16. H

    Code not running when workbook opened

    Hi, As per the title, the below code is not executing when I open the workbook. Sometimes it executes as intended and other times it doesn't. Can anyone suggest a reason why and offer a solution please. The workbook has password protection and is used by other people in my workplace so for...
  17. S

    Workbook_Open fires once only the fails to run again.

    EDIT: Missed an 'n' in the subject. Should be 'then fails to run again' I have a WB containing quite a few Subs. Workbook_Open code calls these and was working but it now fails. Trouble-shooting so far: Copy all sheets and code to a new WB and compile code (no issues). a) The Workbook_Open...
  18. M

    Workbook_open code not working

    I was hoping the below would set row height on opening the file, but it doesn't work. Why would this be?? TIA Private Sub Workbook_Open() Sheets("Bedstat").Range([A6], [A65536].End(xlUp)).EntireRow.RowHeight = 13.5 End Sub
  19. G

    Help with vba code placement please

    I have been trying to get this to work in cell "Q4" all morning. I have put it every where in thisworkbook, Legend, and in a new module. Cant get it to work in cell "Q4" of the Legend. This is the formula I am useing. Private Sub Workbook_Open() Sheets("Sheet1").Range("Q4").Value =...
  20. S

    VBA workbook_Open problem

    I am looking for vba to prevent workbook_open from executing in new save as file without changing the original file. I have a template that I open with a workbook_Open module to auto generate a sequential number. I want to save the new file to a different location with a new name but I dont...

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top