Results 1 to 19 of 19

Thread: Solved: Remember last saved toolbar position

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #13
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    Tommy, will it not allow me to write to a specific drive? At work, our personal drives are I:\, so I changed it to my needs (below) but it doesn't seem to be writing a myPlacement.ini file at all.

    Sub SaveSettingIni(iToolBar As CommandBar)
    Dim DirLoc As String
    DirLoc = "I:\"
    With iToolBar
        WriteIniValue DirLoc & "myPlacement.ini", "Settings", "Position", _
        CStr(.Position)
        WriteIniValue DirLoc & "myPlacement.ini", "Settings", "RowIndex", _
        CStr(.RowIndex)
        WriteIniValue DirLoc & "myPlacement.ini", "Settings", "Left", CStr(.Left)
        WriteIniValue DirLoc & "myPlacement.ini", "Settings", "Top", CStr(.Top)
    End With
    End Sub
    
    Sub ReadSettingIni(iToolBar As CommandBar)
    Dim DirLoc As String
    DirLoc = "I:\"
    With iToolBar
        .Position = Val(ReadIniValue(DirLoc & "myPlacement.ini", "Settings", "Position"))
        .RowIndex = Val(ReadIniValue(DirLoc & "myPlacement.ini", "Settings", "RowIndex"))
        .Left = Val(ReadIniValue(DirLoc & "myPlacement.ini", "Settings", "Left"))
        .Top = Val(ReadIniValue(DirLoc & "myPlacement.ini", "Settings", "Top"))
    End With
    End Sub
    Last edited by Aussiebear; 04-28-2023 at 09:38 PM. Reason: Adjusted the code tags
    Office 2010, Windows 7
    goal: to learn the most efficient way

Posting Permissions

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