+ Reply to Thread
Results 1 to 8 of 8

Excel VBA running upon save

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    shrewsbury
    MS-Off Ver
    Excel 2003
    Posts
    25

    Excel VBA running upon save

    Hi I am having an annoying problem where everytime I Save as a document certain macro runs (this is on the sheet rather than in the module) dependant on the selection for example I have a drop down menu where if you select no then the following macro will be run
    Please Login or Register  to view this content.
    So since the selection is No on saving the document it then means the userform is opened when I save it. Which I do not want to happen. Is there anyway of stopping this as its extremely annoying.

    Thank you in advance.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Excel VBA running upon save

    Is there a code running when you save the workbook?
    Please Login or Register  to view this content.
    How is the ComboBox code being activated by savas?

  3. #3
    Registered User
    Join Date
    10-29-2012
    Location
    shrewsbury
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Excel VBA running upon save

    Well I do have a code which uses the saveas function to save the document but even when I use the normal saveas function in the menu the code just the macro I posted just runs.

    I have assigned the code I posted onto the combobox and like the code says when it is clicked it executes the code and checks if No is selected.

    Im unsure why you have posted that code

    Any guidance would be great, thank you

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Excel VBA running upon save

    Do you have combobox linked to cells in ListFillRange or LinkedCell property?
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  5. #5
    Registered User
    Join Date
    10-29-2012
    Location
    shrewsbury
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Excel VBA running upon save

    I have it linked with ListFillRange

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Excel VBA running upon save

    I think this is reason for code running. When workbook is saved it will recalculate. If this ListFillRange is dynamic or if there are formulas within the range, combobox may believe it has changed, and the event code will run. It is better to fill control using List property in code if possible.

  7. #7
    Registered User
    Join Date
    10-29-2012
    Location
    shrewsbury
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Excel VBA running upon save

    Thank you. Im sure im going to sound stupid but can you explain how you can do the above. Ive never herd of what you are refering to so any tips would be greatly appreciated.

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Excel VBA running upon save

    Of course - code will be like this:
    Please Login or Register  to view this content.
    You must decide when you need to populate list - it may be only when workbook is opened or perhaps each time worksheet is activated?

+ 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. The custom sort list causes my excel to crash after running and then trying to save
    By jonnytales in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-02-2024, 02:22 PM
  2. Macros running when I save a different copy of excel workbook
    By chidmas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2013, 12:49 PM
  3. Excel crashes when trying to save one particular xlsm only after running macro
    By duncandhu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2013, 11:10 AM
  4. [SOLVED] Excel Crashes when trying to save after running a sort macro
    By jed38 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-09-2013, 09:23 AM
  5. [SOLVED] when i save xls file, debug script is running and canno't save fil
    By Imtiaz in forum Excel General
    Replies: 1
    Last Post: 07-16-2005, 11:05 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