(Solved) – Automatically increment revision number if file already exit on web page using vba

(solved)-–-automatically-increment-revision-number-if-file-already-exit-on-web-page-using-vba

I have been tried to automatically increment revision number of display which i’m saving using vba. I have tried it with static one. passing only i= 2 i.e constant number. i tried dynamically increment revision number but i did not get .I when I am using i=2 it every time it gives me display name 2 so that it gives me error that file already exit. I appreciate if you help me to find the solution. Here is my vba code

 Dim i As Integer
    i = 3
     Set IE = New InternetExplorerMedium
      IE.Visible = True

        'Define URL
          IE.Navigate2 "my link here "

         Do While IE.Busy
            Application.Wait DateAdd("s", 1, Now)
         Loop

          Set html = IE.document

        disp_name = html.getElementById("disp-name").innerText

          Set htmlColl = html.getElementsByClassName("save-menu-item")

            For Each htmlInput In htmlColl
              If htmlInput.className = "save-menu-item" Then
           '  MsgBox htmlInput.innerHTML
                If InStr(1, htmlInput.innerHTML, "Save As") Then

                htmlInput.Click
               Set htmlColl3 = html.getElementsByClassName("c-primary-button")

                   Application.Wait (Now()   TimeValue("00:00:05"))
                    Application.SendKeys disp_name & i

                        i = i   1
                        For Each htmlin In htmlColl3
                            Debug.Print htmlin.innerHTML
                           If InStr(1, htmlin.innerHTML, "Save") Then
                               htmlin.Click
                            End If
                        Next htmlin
                        Application.SendKeys ("~")

                  End If
               End If
            Next htmlInput

    End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *