Consulting

Results 1 to 15 of 15

Thread: Solved: save problem

  1. #1

    Solved: save problem

    i have a multipage form with combo's, text, etc and when I save does not store anything... on open is blank.. like brand new... sugestions

  2. #2
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    That's right. Userform's do not store any of their data. You have to 'refresh' it after every start.

    David


  3. #3
    ok so what do I need to do store the data? use beforesave? and when start how do I "refresh" with activate?

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    Have a good look here at Debra's excellent web site
    http://www.contextures.com/exceldata...pdateform.html
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    sorry but the site is too extensive to look for...
    can anyone help in this exactly?

  6. #6
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    So, in your other thread, Zack was showing you how to populate the combobox. Just before closing the form, you need to write the data back to the spreadsheet. Normally I have a Save Or Exit Commandbutton to close the userform. Let's say that button is named cmdSave.

    [VBA]Private Sub cmdSave_Click()
    Sheet2.Range("A1").value = ComboBox1.value
    Unload Me
    End Sub[/VBA]

    David


  7. #7
    sorry but (forgetting the other thead) new form with several things... and when I make save by click as

    [VBA]

    Sub SaveDocument()
    Application.ActiveWorkbook.Save
    End Sub
    [/VBA]

    it does not store anything of what I've written... need something here?
    I just create the form and the textboxes.... probably I have a simple problem but as new in this.... sorry

  8. #8
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    No, this has to be BEFORE you close the userform. The code I suggested should be on the userform code page.

    David


  9. #9
    that means to write in a worksheet...is not any other way to store things?

  10. #10
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    • You can use document variables.
    • You can use built-in documernt variable, like Subject, author, etc. I tend to use these as you can go to document properties and edit them if you need.
    • You can store the data in an external file. E.g. Just a simple text file. Then on exit, delete the file. Or a Random access file. Kinda like a text file, but very difficult to recognize data.
    • You can write them to a hidden sheet, or a obscure location, like ZZZ999.

    David


  11. #11
    and with document variables how do I do it? or in the hidden sheet(can it be xlveryhiddeen)?
    (I prefer the 1st)

    thanks

  12. #12
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    Here's an example.
    [VBA]Sub test()
    Dim wb As Workbook
    Dim docProps As DocumentProperties
    Dim docProp As DocumentProperty
    Set wb = ActiveWorkbook
    Set docProps = wb.CustomDocumentProperties

    With docProps
    .Add Name:="CustomNumber", _
    LinkToContent:=False, _
    Type:=msoPropertyTypeNumber, _
    Value:=1000
    .Add Name:="CustomString", _
    LinkToContent:=False, _
    Type:=msoPropertyTypeString, _
    Value:="This is a custom property."
    .Add Name:="CustomDate", _
    LinkToContent:=False, _
    Type:=msoPropertyTypeDate, _
    Value:=Date
    End With
    For Each docProp In docProps
    Debug.Print docProp.Name, docProp.Value
    Next

    End Sub

    [/VBA]
    in the hidden sheet(can it be xlveryhiddeen)?
    Yes

    David


  13. #13
    sorry I'm to new to this loool
    what is document properties and where the hell are they?
    using excel 2007

  14. #14
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    What are the control names (textbox?) and what type of value are they?

    David


  15. #15
    after cracking my head made a sheet xlveryhidden and putted info there and got it back to the form's

    thanks everyone

Posting Permissions

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