1 Reply Latest reply on Aug 8, 2014 11:32 AM by 2723008

    Problem with a macro for Refresh




      I am working on a file with many sheets that need to be refresh.


      I created a macro that refresh each sheets one after an other.


      However when the first sheet is selected I have a message : "error in grid xml each dimension must be used once and only once"


      I dont understand because when I use it for 1 sheet it work. Moreover even if it dont work for the first sheet all the next one are refresh. Even more strange, when I use the mode step bye step the the message does not appear and every thing work perfectly.


      You can find my code bellow.


      Thank you very much in advance for your help.





      Declare Function HypMenuVRefresh Lib "HsAddin.dll" () As Long
      Declare Function HypConnect Lib "HsAddin.dll" (ByVal vtSheetName As Variant, ByVal vtUserName As Variant, ByVal vtPassword As Variant, ByVal vtFriendlyName As Variant) As Long


      Sub Refresh_Total_Retrieve()

      X = HypConnect(Sheets("Menu"),

      Nbr = ThisWorkbook.Sheets.Count


      For Nbfeuille = 1 To Nbr


           If Sheets(Nbfeuille).Visible = True Then 'If the sheet is not hide
              If Range("A1") = "Retrieve" Then
                  X = HypMenuVRefresh()
              End If
         End If

      End Sub