Results 1 to 19 of 19

Thread: Solved: Remember last saved toolbar position

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,168
    Location
    I found this here :http://www.freevbcode.com/ShowCode.asp?ID=5390

    I modified the form code for a public function so all you should have to do is call these 2 functions with the modules included.

    Sub SaveSettingIni(iToolBar As CommandBar)
        With iToolBar
        WriteIniValue "C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", "Settings", "Position", CStr(.Position)
        WriteIniValue "C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", "Settings", "RowIndex", CStr(.RowIndex)
        WriteIniValue "C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", "Settings", "Left", CStr(.Left)
        WriteIniValue "C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", "Settings", "Top", CStr(.Top)
        End With
    End Sub
    
    Sub WriteSettingIni(iToolBar As CommandBar)
        With iToolBar
        .Position = Val(ReadIniValue( "C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", _
        "Settings", "Position"))
        .RowIndex = Val(ReadIniValue( "C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", _
        "Settings", "RowIndex"))
        .Left = Val(ReadIniValue( _"C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", _
        "Settings", "Left"))
        .Top = Val(ReadIniValue( "C:\Program Files\Microsoft Office\OFFICE11\ADDINS" & "\MyADDIN.ini", _
        "Settings", "Top"))
        End With
    End Sub
    Let me know if you need more help.
    Last edited by Aussiebear; 04-28-2023 at 09:26 PM. Reason: Adjusted the code tags

Posting Permissions

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