+ Reply to Thread
Results 1 to 2 of 2

auto save workbook

  1. #1
    Registered User
    Join Date
    05-08-2014
    MS-Off Ver
    Excel 2007
    Posts
    27

    auto save workbook

    Hi All,

    I had the following code written for me but I want to be able to save the workbook everytime an entry is made.

    Public Sub addEnquiry()

    Dim MediumType As String
    Dim EnquiryReason As String

    Const Medium As Long = 1
    Const Reason As Long = 2

    With Sheets("input")
    If .ListBoxes(Medium).Value = 0 Or .ListBoxes(Reason).Value = 0 Then
    MsgBox "Complete both boxes"
    Exit Sub
    End If

    MediumType = .ListBoxes(Medium).List(.ListBoxes(Medium).Value)
    EnquiryReason = .ListBoxes(Reason).List(.ListBoxes(Reason).Value)
    .ListBoxes(1).Value = 0
    .ListBoxes(2).Value = 0
    End With

    With Sheets("data").Range("a1").CurrentRegion
    .Offset(.Rows.Count).Resize(1, 3).Value = Array(MediumType, EnquiryReason, Now())
    End With


    End Sub

    Can anyone help?

    Thanks

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: auto save workbook

    Whenever in your code you want it to save, put the line: activeworkbook.save

    (cause I'm not sure when the entry is done, but you will)

+ 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. [SOLVED] Auto save marco on a specific workbook
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2013, 01:50 PM
  2. Auto Save Workbook
    By rhudgins in forum Excel General
    Replies: 1
    Last Post: 12-10-2010, 06:41 PM
  3. Auto Save Workbook
    By SVTF in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2010, 02:28 AM
  4. [SOLVED] Auto-export on workbook save
    By [email protected] in forum Excel General
    Replies: 0
    Last Post: 08-03-2005, 09:05 AM
  5. [SOLVED] Auto Excel workbook close: save= false during an auto subroutine
    By tomwashere2 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-16-2005, 02: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