+ Reply to Thread
Results 1 to 4 of 4

Saving data

  1. #1
    Registered User
    Join Date
    08-10-2005
    Posts
    56

    Saving data

    Hi,

    I have spreadsheet to which users are adding data via UserForms. I would like to save the data as the user is entering it and to remove the 'Do you want to save changes' message box that appears when the user closes down excel.

    Any idears

    Regards

    Bach

  2. #2
    John
    Guest

    Re: Saving data

    Hi Bach,

    Use the .Saved workbook property.

    Application.ActiveWorkbook.Save
    Application.ActiveWorkbook.Saved = True

    Best regards

    John

    "bach" <bach.1wh0uc_1128585916.5488@excelforum-nospam.com> wrote in message
    news:bach.1wh0uc_1128585916.5488@excelforum-nospam.com...
    >
    > Hi,
    >
    > I have spreadsheet to which users are adding data via UserForms. I
    > would like to save the data as the user is entering it and to remove
    > the 'Do you want to save changes' message box that appears when the
    > user closes down excel.
    >
    > Any idears
    >
    > Regards
    >
    > Bach
    >
    >
    > --
    > bach
    > ------------------------------------------------------------------------
    > bach's Profile:
    > http://www.excelforum.com/member.php...o&userid=26134
    > View this thread: http://www.excelforum.com/showthread...hreadid=473685
    >




  3. #3
    Registered User
    Join Date
    08-10-2005
    Posts
    56

    Thanks

    I have included, this code inside a private sub when the user enteres the data into the spreadsheet i have saved it.

    This does not stop the message appearing to save changes when closing the workbook, this is because of the fact that the save code is inside a private sub ??

  4. #4
    John
    Guest

    Re: Saving data

    Hello Bach,

    No, being in a Private sub shouldn't make any difference.

    Are you sure that this part of the code is actually being executed? Maybe
    step through it line by line (using F8 key) to check that this is happening.

    Another other thing is have you changed the code to reference the correct
    Workbook? The code below would be fine if only one workbook is open, but is
    it possible the user has two workbooks open? Begin the procedure by setting
    a reference to the correct workbook:

    Dim myWkb As Workbook

    Set myWkb = Application.ActiveWorkbook
    'Your code here
    myWkb.Save
    myWkb.Saved = True

    A final possibility is that something else is being changed in between the
    workbook Saved property being set to true and the workbook actually closing.
    If this is the case then the property will be reset to False and you'll be
    asked if you want to save.

    Hope that helps.

    Best regards

    John

    > Application.ActiveWorkbook.Save
    > Application.ActiveWorkbook.Saved = True


    "bach" <bach.1wj6me_1128686728.5325@excelforum-nospam.com> wrote in message
    news:bach.1wj6me_1128686728.5325@excelforum-nospam.com...
    >
    > I have included, this code inside a private sub when the user enteres
    > the data into the spreadsheet i have saved it.
    >
    > This does not stop the message appearing to save changes when closing
    > the workbook, this is because of the fact that the save code is inside
    > a private sub ??
    >
    >
    > --
    > bach
    > ------------------------------------------------------------------------
    > bach's Profile:
    > http://www.excelforum.com/member.php...o&userid=26134
    > View this thread: http://www.excelforum.com/showthread...hreadid=473685
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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