Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: How do I allow users to save changes to worksheet data store

  1. #1
    New Member
    Join Date
    Mar 2002
    Location
    Forest, VA
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    I have an AddIn that when run, displays a dialog box. This dialog box has a listbox with entries filled in from data stored in a worksheet of the AddIn. I would like for the user to be able to make modifications to this list and so through a multipage form, I have provided a means for the user to do this. It appears to work fine and the new item is shown on the list. But, if the user exists Excel and then restarts or removes and then adds the AddIn, the changes are lost. Is there any way to make those changes permanent for that user? I use the Save method of the workbook with the .xla extension.

    Thanks for your help,
    Vlip

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Couldn't you just capture the username via an API call, save his/her info to a text file, and then recall when needed????

    I have the API code if you need it.

    Will have to look

    [ This Message was edited by: TsTom on 2002-03-22 20:39 ]

  3. #3
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Following is API call for username:

    Option Explicit
    Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
    (ByVal lpBuffer As String, _
    nSize As Long) As Long

    Sub Get_User_Name()

    Dim lpBuff As String * 25
    Dim ret As Long, UserName As String
    ret = GetUserName(lpBuff, 25)
    UserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
    MsgBox UserName

    End Sub
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  4. #4
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Just have all entries stored on a sheet in the Add-in Workbook and use the "Rowsource" Property to return the list to the user.



  5. #5
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Not sure what the problem is, but I feel is that Excel isn't saving the AddIn when closed.

    In the code put a line like

    ThisWorkbook.Save

    after the user has made the modifications he needs to do.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  6. #6
    New Member
    Join Date
    Mar 2002
    Location
    Forest, VA
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I do have a line with ThisWorkbook.Save but it isn't saving. That's what the problem is. For some reason, it does not save.

    Vlip

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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