+ Reply to Thread
Results 1 to 2 of 2

Saving DTPicker settings in Userform

Hybrid View

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    78

    Saving DTPicker settings in Userform

    Hi--

    I hope somoene can help me with this. I just cannot figure out how to get this to work. I want to have a Userform retain the last date that was selected in a DTPicker control but no matter what I try, it keeps defaulting to today's date.

    The form opens specified files based on Region, Report Name and Date. So, for example - today is 10/17 amd I am pulling reports for the week ending 10/12:

    1.I select 10/12 with the DatePicker, click my OK button and it opens the correct file.
    2.I "Exit" the form (using the Exit button for which the code is posted above), do what I need to do with the file and close it.
    3.Then when I invoke the form to open the next file, the date in the DatePicker defaults back to today's date rather than 10/12 remaining selected.




    The Exit button has the following code:
    Private Sub ExitButton_Click() 
         '   Store settings
        On Error Resume Next 
        SaveSetting AppName, "Settings", "ReportIndex", UserChoices(1) 
        SaveSetting AppName, "Settings", "RegionIndex", UserChoices(2) 
        SaveSetting AppName, "Settings", "DTPicker1", DTPicker1.Value 
        Unload Me 
    End Sub
    and the form Initialize code is:


    Private Sub UserForm_Initialize() 
        With Me 
            .Caption = AppName 
            .Width = 333 
            .Height = 100 
        End With 
         
         '   Get previous settings
        UserChoices(1) = GetSetting(AppName, "Settings", "ReportIndex", 0) 
        UserChoices(2) = GetSetting(AppName, "Settings", "RegionIndex", 0) 
        DTPicker1.Value = GetSetting(AppName, "Settings", "DTPicker1") 
         
    End Sub
    Can anyone please offer any guidance?
    Last edited by jerrydiaz; 10-17-2014 at 02:52 PM.

  2. #2
    Registered User
    Join Date
    08-10-2012
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Saving DTPicker settings in Userform

    Sooo, anybody?

+ 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] VBA userform DTPicker
    By Hilton1982 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2012, 02:58 AM
  2. not saving the settings
    By scancool in forum Excel General
    Replies: 0
    Last Post: 11-14-2012, 11:54 AM
  3. [SOLVED] Calendar or DTPicker Userform replacement?
    By MarvinP in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-05-2012, 02:10 AM
  4. Saving Sort Settings
    By ucfchick in forum Excel General
    Replies: 2
    Last Post: 02-10-2006, 12:10 PM
  5. HELP! Settings are not saving
    By Veronica in forum Excel General
    Replies: 4
    Last Post: 10-14-2005, 01: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