+ Reply to Thread
Results 1 to 2 of 2

VBA causing workbook to open whenever I open excel.

  1. #1
    Registered User
    Join Date
    09-09-2008
    Location
    Southampton
    Posts
    19

    VBA causing workbook to open whenever I open excel.

    I've got a workbook, Orders2015.xlsm that is populated by a Microsoft Query, and I want a messagebox to pop up when you open it, asking if you want to refresh the data. I don't know much about VBA so I googled it and now have this in ThisWorkbook:

    Private Sub Workbook_Open()
    Dim Msg, Style, Title, Response
    Msg = "Do you want to refresh the order list?"
    Style = vbYesNo
    Response = MsgBox(Msg, Style)
    If Response = vbYes Then
    Sheets("Orders").Select
    ActiveWorkbook.RefreshAll
    Exit Sub
    End If

    End Sub

    Which does work, however it is causing Orders2015.xlsm to open when I open other workbooks as well. Can anyone tell me what I've done wrong?
    Thanks in advance.

  2. #2
    Registered User
    Join Date
    01-23-2015
    Location
    Frankfurt
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Re: VBA causing workbook to open whenever I open excel.

    Hi Jessica,

    is it possible that you put your code into your personal macro file (Personal.xlsb) instead of Orders20015.xlsm?

    Cheers,
    Artiszta

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 11
    Last Post: 08-02-2014, 03:22 AM
  2. [SOLVED] Workbook links causing linked workbook to open, but remain hidden
    By Rob T in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-20-2014, 06:24 AM
  3. Open Workbook if closed, keep open if open, insert password
    By jwahl16 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-09-2013, 04:09 PM
  4. Repeated Opening with VBA calls causing Excel files to open slowly
    By al0501 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2009, 02:06 AM
  5. [SOLVED] Excel workbook does not open in open window on desktop
    By DeanH in forum Excel General
    Replies: 2
    Last Post: 03-08-2005, 06:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1