How to automate File Uploads using excel macros

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ก.ย. 2024
  • In this tutorial we would learn:
    1. How to automate File uploads using excel macro.
    2. Calling vb script from excel macro
    For pre-requisites to this tutorial please refer below tutorial:
    • How to Automate Web Sc...

ความคิดเห็น • 143

  • @TanvirAhmed1992
    @TanvirAhmed1992 ปีที่แล้ว

    Hello Sir, For the past 7 days, I was going crazy to find a way to automate the file upload process. I was stuck passing the file name in the file input box. Your tutorial is clean and helped me a lot. Thanks a lot.

  • @TanveshDabholkar
    @TanveshDabholkar 4 ปีที่แล้ว +1

    This was amazing, im a civil engineer and im learning vba myself from past few years, this was a new trick that i learned, thanks.

  • @arvinthnair2856
    @arvinthnair2856 3 ปีที่แล้ว +1

    Very underrated video. I have been trying to find this solution for far too long. Thank you! I am able to modify the code for my use and it works perfectly!

  • @user-reckon_
    @user-reckon_ 2 ปีที่แล้ว

    OMG!! Thank you so much!!!
    I wasted too much time to search this solution!

  • @muralikrishnanayyappan6513
    @muralikrishnanayyappan6513 3 ปีที่แล้ว +1

    Thanks a tonne my friend ! Wonder why google doesnt throw up your video first when you search for how to upload a file in a VBA script - especially - when doing WebForms. Brilliant video Sir !

  • @tishamurvihill3903
    @tishamurvihill3903 3 ปีที่แล้ว +1

    Very Helpful!! I find my cursor is not always in the same place in the select file window (probably a new feature since video posted). A suggestion is to replace the "{tab}" section of the shell script with:
    WshShell.SendKeys "%{n}"
    WScript.Sleep 2000
    WshShell.SendKeys "^{v}"
    WScript.Sleep 2000
    WshShell.SendKeys "%{o}"
    This is alt-n, ctrl-v, alt-o -- alt-n takes you directly to the filename input field, ctrl-v pastes, alt-o activates the 'Open' btn.

  • @GregMontiel
    @GregMontiel 3 ปีที่แล้ว

    Sin mentir, pase mas de 12 horas buscando alternativas para poder realizar esto, muchas gracias por este truco super genial.
    Saludos.

  • @ElWiwif
    @ElWiwif 3 ปีที่แล้ว +1

    Love you buddy! Thanks for sharing your amazing inputs!! Cheers to you!

  • @rpregis2able
    @rpregis2able 3 ปีที่แล้ว

    Amazing ...much benefited from these tutorials. Thank you

  • @Amangupta-kj8vw
    @Amangupta-kj8vw 4 ปีที่แล้ว +1

    Thanks a lot ! It's very helpful 😁

  • @pallasri88
    @pallasri88 3 ปีที่แล้ว

    Amazing, neat and clear explanation even I am new to excel macro able to understand the concept clearly. Started with edge browser and performed few operation(sendkeys, click, drop downs, check box) r but i am unable to automate file upload.
    Kindly provide steps to automate File Uploads in edge browser which helps me a lot.
    Thanks in advance.

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว +1

      Code written in vbs file must be written in the vba macro itself for edge. No need to use separate vbs file for file uploads on edge and chrome browsers.

    • @pallasri88
      @pallasri88 3 ปีที่แล้ว

      @@AutomationMadeEasy Thanks a lot . kindly provide the code to automate file upload in edge browser which helps me a lot.

  • @prasenjitmandal5486
    @prasenjitmandal5486 2 ปีที่แล้ว

    For you i got the appreciation. You are magical

    • @AutomationMadeEasy
      @AutomationMadeEasy  2 ปีที่แล้ว

      thank you

    • @prasenjitmandal5486
      @prasenjitmandal5486 2 ปีที่แล้ว

      Hi,can u upload some videos on VBA with Desktop application through API. It will be really great.

  • @jackwhite801
    @jackwhite801 3 ปีที่แล้ว +1

    Hello sir,
    nice video... I have tried to upload images in my wordress website but I am getting run time error. can you please make a video how can upload image in WordPress with macro ?
    thank you

  • @shishirjoshii2844
    @shishirjoshii2844 3 ปีที่แล้ว

    Really awesome, thanks for sharing.

  • @juanoviedo587
    @juanoviedo587 ปีที่แล้ว

    Excellent Work !! Congratulations, Where can i have to source code ? Thanks !

  • @mountainboyindesert2357
    @mountainboyindesert2357 ปีที่แล้ว

    Hi, thanks for this wonderful video - really cool, just if u could also help with the loop - actually i want to upload 50files so looking for loop code to copy the path from excel file and do the upload and come back again to copy next one till last, any help will be appreciated

  • @rudhresansekar2199
    @rudhresansekar2199 2 ปีที่แล้ว

    Hi thanks for the codes, seems good.
    I’m trying the same example file of yours but once the upload window opens “windows script host settings” nothing happens later.
    Then excel is waiting for “ to complete an ole action

  • @elricho72
    @elricho72 2 ปีที่แล้ว

    Great Video, and how can I upload with VBA on google Drive ?

  • @natalyn3711
    @natalyn3711 2 ปีที่แล้ว

    Hi, I can go into the website using macro but I keep getting prompt with there is no script engine for the extension ".xlsm". The file I want to upload is an Excel File btw. Do you know what's causing this?

  • @vaibhavpatil7227
    @vaibhavpatil7227 4 ปีที่แล้ว

    thanks sir for this video. i requesting you to please prepare video for download file with dynamic path.

  • @_.Light._
    @_.Light._ 2 ปีที่แล้ว

    Nice one. Iam looking for something similar. Have you uploaded video for multiple files upload for multiple webpages?

    • @_.Light._
      @_.Light._ 2 ปีที่แล้ว

      Basically I have 50files and each file goes to each tab on a same website.

  • @chandrum3675
    @chandrum3675 4 ปีที่แล้ว

    Hi Bro, i am your subscriber and loved all your video's. is this possible to upload multiple file by using the same macro? Please advise.

    • @sreejitharavind3959
      @sreejitharavind3959 2 ปีที่แล้ว

      Have u been able to figure this out. I am facing similar challenge

  • @MrLSUfanatic
    @MrLSUfanatic 4 ปีที่แล้ว

    Thank you so much, this was very helpful! But I have run into an issue. When I run this, sometimes the script pastes the correct file path into the file name box, but sometimes the script just types in "v" into the file name box, so it seems the script is missing the ^ (Ctrl) sometimes when it runs. Do you know why this would happen?

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      Try adding some more delay befor ctrl c and ctrl v

  • @omnarayan7066
    @omnarayan7066 2 ปีที่แล้ว

    Very nice

  • @anjarsaputra7909
    @anjarsaputra7909 3 ปีที่แล้ว

    I have an error' out of range because WsScript.arguments(0), how to solve it

  • @abkhan2262
    @abkhan2262 7 หลายเดือนก่อน

    how do we automate in case if there are 100s of files created everyday? and we have submit 1 file only once and we have to keep on uploading newer files to the upload link. i am asking this for a manufacturing company quality lab.
    Thanks

    • @AutomationMadeEasy
      @AutomationMadeEasy  7 หลายเดือนก่อน

      filenames with folder locations must be provided in rows of excel sheet. Using a loop the files will be read and uploaded one by one

  • @parghi22
    @parghi22 2 ปีที่แล้ว

    Hi, I'm getting an "Invalid procedure call or argument" on the Shell line of code. Any idea what could be causing this??

    • @AutomationMadeEasy
      @AutomationMadeEasy  2 ปีที่แล้ว

      try selecting microsoft shell reference from Tools/Reference

  • @jim3805
    @jim3805 3 ปีที่แล้ว

    When using chrome for this, is there a good way to use a Do While loop like with IE.busy & .Readystate?

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว +1

      we need to wait for the element to be visible or in some cases the element to get enabled.

  • @vijaykolambe3917
    @vijaykolambe3917 3 ปีที่แล้ว

    Hi,
    Can this code take the file path from excel worksheet and upload multiple files ?

  • @rameshgohil1984
    @rameshgohil1984 2 ปีที่แล้ว

    Shell"wscript.exe " & strFile & " " & strUploadFile (showing compile error and syntax error) please help

  • @luckyplayz1426
    @luckyplayz1426 3 ปีที่แล้ว

    When my upload file path contain space in it then I am facing issue in pasting the path. Can you please help.
    Eg path : E://New Folder/file.txt
    In this above scenario while pasting the url only "E://New" is getting pasted

  • @kryptonrules
    @kryptonrules 4 ปีที่แล้ว +1

    I am getting the error 462 which says The remote server machine does not exist or is unavailable. Ay idea how to resolve this?
    I checked and followed everything and also took note of comments added everything.

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      can you share your code?

    • @kryptonrules
      @kryptonrules 4 ปีที่แล้ว

      @@AutomationMadeEasy Thanks for getting back. Really appreciate it. The page opens but then the upload is not working there is when i get the error.
      The below is the code i copied from your provided space. But in turn i am trying to upload a folder from desktop to Dropbox and then use those uploaded image files back into excel and then then convert them into URL's.
      The below is the vbs file:
      Set WshShell = CreateObject("WScript.Shell")
      Do
      ret = WshShell.AppActivate("Choose File to Upload")
      Loop Until ret = True
      WScript.Sleep 1000
      ret = WshShell.AppActivate("Choose File to Upload")
      If ret = True Then
      WshShell.Run "cmd.exe /c echo " & WScript.Arguments(0) & "| clip", 0, True
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "^{v}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{ENTER}"
      End If
      WScript.Sleep 1000
      Set WshShell = nothing
      The next is the module code:
      Sub uploadFiles()
      Set IE = CreateObject("InternetExplorer.Application")
      IE.navigate "www.automationandagile.com/p/sample-form.html"
      IE.Visible = True
      Application.Wait DateAdd("s", 5, Now)
      strFile = "C:\Users\user\Desktop\UploadFile.vbs" '--Mention path where you stored the .vbs file in Step 3
      strUploadFile = "C:\Users\user\Desktop\EUebGt1XkAYe9N81.png" '--Mention path of the file which you wish to upload
      Shell "wscript.exe " & strFile & " " & strUploadFile
      IE.document.getElementsByName("myFile")(0).Click
      Application.Wait DateAdd("s", 2, Now)
      End Sub

    • @kryptonrules
      @kryptonrules 4 ปีที่แล้ว

      I will be working to automate my scenario once your works. So would be great if you could help!

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      go to tools/references
      Select Microsoft Shell Controls and Automation
      Save then re try

    • @kryptonrules
      @kryptonrules 4 ปีที่แล้ว

      @@AutomationMadeEasy Already did that.

  • @kathikth
    @kathikth 4 ปีที่แล้ว

    can we do the same from google chrome rather than IE ? , if so please help us by providing the code for the same.. because most of the company which we are working has started using chrome than IE , may be for the speedness ..
    so request you to make a saparate video or you can do the continuation of this same with chrome.. pls ..

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว +1

      Refer below tutorial for web automation using chrome:
      th-cam.com/video/-GUw22ecRwI/w-d-xo.html
      For file upload automation use the same techhique as explained or copy the vbs script code in moacro module. It will work

  • @christianvalle87
    @christianvalle87 3 ปีที่แล้ว

    how can i do the same thing but with another browser, maybe chrome or firefox?? thanks! And can you share the files from the video?

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว

      For chrome or edge refer below tutorial:
      th-cam.com/video/AEp0Yeis9AM/w-d-xo.html
      Apply the sam logic for file upload. The script is provided in the blog itself.

  • @kanniyappan9571
    @kanniyappan9571 3 ปีที่แล้ว

    This code was fabulous.but when it always takes second Items in the folder path any solution ?

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว

      didnt get your question. Can you explain with an example?

    • @kanniyappan9571
      @kanniyappan9571 3 ปีที่แล้ว

      @@AutomationMadeEasy File Explorer box has been opening but did not paste the copied item in File name . How to give delay in vbscripts any example

  • @charlesjohnson3703
    @charlesjohnson3703 ปีที่แล้ว

    I need to upload all the files in a folder. I can use
    wshshell.sendkeys "^{A}"
    to select all the files, but then, how to modify this line
    Shell "wscript.exe " & strFile & " " & strUploadFile
    Really don't want want to have to resort to uploading all the files individually.
    Any help greatly appreciated.

  • @jim3805
    @jim3805 3 ปีที่แล้ว

    Is there a way to do this on a rdc. It seems that the vbs file will only enter the file path of what I'm trying to upload if I'm active. Any tips?

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว

      this approach needs the window to stay in focus so it wont work if remote desktop is minimized. But on certain web pages it is possible to enter file path without opening the File upload dialog. Will need to to see your web page to assess if that approach can be used

    • @jim3805
      @jim3805 3 ปีที่แล้ว +1

      Thanks, I after researching I did it with this FindElementByXPath(".../div[1]/span/input").SendKeys (dirFile) , which seems to be another way to do it without needing vbs

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว

      great

  • @alaingolds
    @alaingolds 4 ปีที่แล้ว

    Hello, Once I run the VBA everything works fine, but after the VBS script sends the sendkey {enter}, my file does upload but I get a "windows script host error" saying "There is no file extension in "c:\Users\alain\onedrive\desktop\automation\loan" but my full path in VBA is "C:\Users\alain\OneDrive\Desktop\Automation\Loan Entry\Resources\FileUpload.VBS". It seems to cut off the last part of it and I don't know why? any suggestions?

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว +1

      if you see there is space between Loan and Entry in the 'Loan Entry' folder. This technique fails if there are spaces in the file path. Try to rename the folders without space and try

    • @alaingolds
      @alaingolds 4 ปีที่แล้ว

      @@AutomationMadeEasy Thank you So much for the help! that fixed that issue!!! I have one final question. I am have a macro that calls this macro and sometimes instead of pasting the file path into the upload window, it just pastes as "v" as if it didn't pick up the "^" for the command +v paste sendkey. any recommendation? Overall this has been super helpful

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      Try to increase the delay before ^c and ^v

  • @abhishekdhaundiyal3664
    @abhishekdhaundiyal3664 4 ปีที่แล้ว

    The execution is stopping at the below line
    Shell "wscript.exe " & strVBSFile & " " & strUploadFile
    saying " Run Time Error 5 - Invalid procedure call "
    Not even opening the choose file to upload window as the command to click on browse is below this line. please explain how is it working for you

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      the steps are explained in detail with the code on the blog which was used in the tutorial. Please refer the same.

    • @abhishekdhaundiyal3664
      @abhishekdhaundiyal3664 4 ปีที่แล้ว

      Automation Made Easy - I tried but couldn't find! Could you plz upload the blog link here for easy reference..Thanks :)

    • @ariefarfiansyah3677
      @ariefarfiansyah3677 4 ปีที่แล้ว

      Same as me

  • @egyadyafahrezy1214
    @egyadyafahrezy1214 ปีที่แล้ว

    How to do the loop then?

  • @nitinsuryawanshi8601
    @nitinsuryawanshi8601 4 ปีที่แล้ว +1

    How can we automatically upload data particular link

    • @nitinsuryawanshi8601
      @nitinsuryawanshi8601 4 ปีที่แล้ว

      How can we automatically upload multiple data particular link in one click from local machine folder

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      Can you give an example as to what you actually want to achieve

    • @nitinsuryawanshi8601
      @nitinsuryawanshi8601 4 ปีที่แล้ว

      Automation Made Easy I want to upload multiple excel file in share point link on daily basic from local machine please suggest how can we do that

  • @prathapr1732
    @prathapr1732 4 ปีที่แล้ว

    Hi , i tried the procedure but when the screen opens to select path, the path didnt got copied or paste.
    can you help me to sort this out

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว +1

      shre ur code

    • @prathapr1732
      @prathapr1732 4 ปีที่แล้ว

      Dim IE As Object
      Dim strVBSFile As String
      Dim strUploadFile As String
      Set IE = CreateObject("InternetExplorer.Application")
      IE.Navigate "www.automationandagile.com/p/sample-form.html"
      IE.Visible = True
      Do While IE.Busy Or IE.ReadyState 4
      Application.Wait DateAdd("s", 1, Now)
      Loop
      strVBSFile = "E:\VBA\FileUpload.vbs"
      strUploadFile = "E:\VBA\Book1.xlsm"
      Shell "wscript.exe " & strVBSFile & " " & strUploadFile
      IE.Document.getElementsByName("myFile")(0).Click
      Application.Wait DateAdd("s", 2, Now)
      End Sub

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      this is a working code. There could be sme error in your vbs file

    • @prathapr1732
      @prathapr1732 4 ปีที่แล้ว

      @@AutomationMadeEasy hello thanks for looking into the code pls look into the vba Set WshShell = CreateObject("WScript.Shell")
      Do
      ret = WshShell.AppActivate("Choose File to Upload")
      Loop Until ret = True
      WScript.Sleep 500
      ret = WshShell.AppActivate("Choose File to Upload")
      If ret = True Then

      WshShell.Run "cmd.exe \C echo " & WScript.Arguments(0) & "| clip", 0, True
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "^{v}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{ENTER}"
      End If
      WScript.Sleep 500
      Set WshShell = nothing

  • @LoudFindings
    @LoudFindings 5 ปีที่แล้ว

    बेस्ट

  • @kangamo7944
    @kangamo7944 3 ปีที่แล้ว

    I've tried selenium vba
    but it doesn't work

  • @anjarsaputra7909
    @anjarsaputra7909 4 ปีที่แล้ว

    Hi , i tried the code but when the dialog box opens to select path, the path didnt got copied or paste.

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      share ur code

    • @anjarsaputra7909
      @anjarsaputra7909 4 ปีที่แล้ว

      @@AutomationMadeEasy this is the code in VBA
      strFile = "E:\2020\Fileupload.vbs" '--Mention path where you stored the .vbs file in Step 3
      strUploadFile = "E:\2020\104.pdf" '--Mention path of the file which you wish to upload
      Shell "Wscript.exe " & strFile & " " & strUploadFile
      HTMLdoc.all.RawasLhpForm_fbalk.Click
      and the code below (VBS) :
      Set WshShell = CreateObject("WScript.Shell")
      Do
      ret = WshShell.AppActivate("Choose File to Upload")
      Loop Until ret = True
      WScript.Sleep 500
      ret = WshShell.AppActivate("Choose File to Upload")
      If ret = True Then
      WScript.Sleep 2000
      WshShell.Run "cmd.exe /c echo " & WScript.Arguments(0) & "| clip", 0, True
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "^{v}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{ENTER}"
      End If
      WScript.Sleep 500
      Set WshShell = nothing

    • @anjarsaputra7909
      @anjarsaputra7909 4 ปีที่แล้ว

      Sometime it works but i try again it didnt work, it appears only "v"

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      try increasing the delay

    • @anjarsaputra7909
      @anjarsaputra7909 4 ปีที่แล้ว

      @@AutomationMadeEasy delay on vba or in vbscript?

  • @sumitpetal
    @sumitpetal 3 ปีที่แล้ว

    I am getting runtime error 7 out of memory. Can you please help me to solve this error.

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว

      share ur code

    • @sumitpetal
      @sumitpetal 3 ปีที่แล้ว

      @@AutomationMadeEasy here is my code
      Sub testauto()
      Dim obj As New WebDriver
      obj.Start "edge", ""
      obj.Get "My Website Admin URL"
      obj.FindElementByName("log").SendKeys ("Website USERNAME")
      obj.FindElementByName("pwd").SendKeys ("Website Password")
      obj.FindElementByName("wp-submit").Click
      obj.Get "Website Post URL Where I want to Upload Image"
      strUploadFile = "E:\AbcMall.png"
      strVBSFile = "E:\UploadFile.vbs"
      Shell "wscript.exe " & strVBSFile & " " & strUploadFile
      obj.FindElementByXPath("//*[@class='wpsm_tax_helper_upload_image_button button']").Click
      obj.FindElementById("menu-item-upload").Click
      obj.FindElementById("__wp-uploader-id-1").Click
      Application.Wait DateAdd("s", 2, Now)
      obj.FindElementById("attachment-details-alt-text").SendKeys ("sumit")
      obj.FindElementByXPath("//*[@class='button media-button button-primary button-large media-button-select']").Click
      Application.Wait DateAdd("s", 2, Now)

      End Sub
      _______________________________________________
      VBS FILE CODE
      _______________________________________________
      Set WshShell = CreateObject("WScript.Shell")
      Do
      ret = WshShell.AppActivate("Open")
      Loop Until ret = True
      WScript.Sleep 1000
      ret = WshShell.AppActivate("Open")
      If ret = True Then

      WshShell.Run "cmd.exe /c echo " & WScript.Arguments(0) &"|clip", 0, True
      WScript.Sleep 5000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 4000
      WshShell.SendKeys "^{v}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{ENTER}"
      End If
      WScript.Sleep 1000
      Set WshShell = nothing
      The Image path is copied but It was unable to paste in the dialogbox.
      I am using wordpress website, Windows 10 and Microsoft Office 2019 Version and I am using selenium basic for automation.
      Can you please check and tell me is there any problem ?
      Thank you so much.

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว +1

      Since you are using selenium vba, No need to use seperate vbs file.
      After clicking on browse button you can use the tab and enter keys as given below:
      Set WshShell = CreateObject("WScript.Shell")
      WshShell.Run "cmd.exe /c echo " & strUploadFile &"|clip", 0, True
      Application.Wait DateAdd("s", 2, Now)
      obj.FindElementByXPath("//*[@class='wpsm_tax_helper_upload_image_button button']").Click
      Application.Wait DateAdd("s", 2, Now)
      Application.SendKeys "{TAB}"
      Application.Wait DateAdd("s", 2, Now)
      Application.SendKeys "{TAB}"
      Application.Wait DateAdd("s", 2, Now)
      Application.SendKeys "^{v}"
      Application.Wait DateAdd("s", 2, Now)
      Application.SendKeys "{TAB}"
      Application.Wait DateAdd("s", 2, Now)
      Application.SendKeys "{TAB}"
      Application.Wait DateAdd("s", 2, Now)
      WshShell.SendKeys "{ENTER}"

    • @sumitpetal
      @sumitpetal 3 ปีที่แล้ว

      @@AutomationMadeEasy Thank you so much sir, It working perfectly.

  • @balajiprasath3895
    @balajiprasath3895 4 ปีที่แล้ว

    Its opening but not uploading

  • @diegosolano707
    @diegosolano707 4 ปีที่แล้ว

    Hola Bro, cuando ejecuto la macro y luego de bastantes segundos, me dice : "Microsoft está esperando a que ' ' complete una acción OLE". Que puede ser esto y como lo soluciono? por favor ayuda

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      share your code.

    • @diegosolano707
      @diegosolano707 4 ปีที่แล้ว

      @@AutomationMadeEasy
      Hola
      por supuesto. Aquí lo detallo. Los dos archivos están guardados en C:\CARPTEMPORAL. Por favor ayuda
      'Este es el Codigo VBA
      Sub uploadFile()
      Set IE = CreateObject("InternetExplorer.application")
      IE.navigate "girardot-cundinamarca.gov.co/Ciudadanos/Paginas/Carga-Archivo.aspx"
      IE.Visible = True
      Do While IE.Busy Or IE.readyState 4
      Application.Wait DateAdd("s", 1, Now)
      Loop
      strUploadFile = "C:\CARPTEMPORAL\text1.txt"
      strVBSFile = "C:\CARPTEMPORAL\FileUpload.vbs"
      Shell "WScript.exe " & strVBSFile & " " & strUploadFile
      IE.document.getElementById("ctl00_ctl58_g_280f7905_95ae_4ab5_b3cd_e1765b71e240_ctl00_ATXT").Click
      Application.Wait DateAdd("s", 1, Now)
      End Sub
      'ESTE ES EL CÓDIGO DEL SCRIPT
      Set WshShell = CreateObject("WScript.Shell")
      Do
      ret = WshShell.AppActivate("Choose File to Upload")
      Loop Until ret = True
      WScript.Sleep 1000
      ret = WshShell.AppActivate("Choose File to Upload")
      If ret = True Then
      WshShell.Run "cmd.exe/c echo " & WScript.Arguments(0) &"| clip", 0, True
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "^{v}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{TAB}"
      WScript.Sleep 2000
      WshShell.SendKeys "{ENTER}"
      End If
      WScript.Sleep 1000
      Set WshShell = nothing

    • @diegosolano707
      @diegosolano707 4 ปีที่แล้ว

      @@AutomationMadeEasy please help. i share the code

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      WshShell.Run "cmd.exe/c echo " & WScript.Arguments(0) &"| clip", 0, True
      In above command a space is missed after cmd.exe. Correct command is given below:
      WshShell.Run "cmd.exe /c echo " & WScript.Arguments(0) &"| clip", 0, True

    • @diegosolano707
      @diegosolano707 4 ปีที่แล้ว

      @@AutomationMadeEasy I did it but the problem persists.
      In Excel say: "Microsft excel está esperando que otra aplicación complete una acción OLE"
      Please help me, how can i solve it?

  • @ednedn2326
    @ednedn2326 3 ปีที่แล้ว

    How to upload file with long filename / filepath?

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว

      as long as there are no spaces in file path and file name it will work

    • @ednedn2326
      @ednedn2326 3 ปีที่แล้ว

      Is it possible to handle the spaces, e.g., add under_score to file name/path? Thanks

    • @ednedn2326
      @ednedn2326 3 ปีที่แล้ว

      @@AutomationMadeEasy Thanks for great video. I got another problem, when using vba to click a option button (totally 2 options) (not the default one), i got error "91". Grateful if could advise. Thanks again.

    • @AutomationMadeEasy
      @AutomationMadeEasy  3 ปีที่แล้ว

      need to see your script

    • @ednedn2326
      @ednedn2326 3 ปีที่แล้ว

      @@AutomationMadeEasy My script:
      Set radioButtons = doc.getElementsByName(CDType6)
      radioButtons(1).Click

  • @JK-hm3lf
    @JK-hm3lf 4 ปีที่แล้ว

    Shell line in vba module giving syntax error. ☹

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว +1

      try selecting Shell Controls and automation from Tool/References

    • @JK-hm3lf
      @JK-hm3lf 4 ปีที่แล้ว

      @@AutomationMadeEasy Thank you so much for guidance and such code. Now it is working well.
      I was searching on internet for many months about uploading a file on html page, but yet not found such code. It is a greate help.

    • @JK-hm3lf
      @JK-hm3lf 4 ปีที่แล้ว

      These are "Microsoft Shell Controls and Automation".

    • @AutomationMadeEasy
      @AutomationMadeEasy  4 ปีที่แล้ว

      your welcome

    • @JK-hm3lf
      @JK-hm3lf 4 ปีที่แล้ว

      A month ago it worked well. Now on same system the same code is not pasting the image path in file upload window. Recommended shell controls are also checked. Don't know whats wrong happened to it.

  • @LoudFindings
    @LoudFindings 5 ปีที่แล้ว

    Tell us about that shell vba file, any ur tutorial link. Please

  • @marcocremaschini1854
    @marcocremaschini1854 3 ปีที่แล้ว

    Sorry, but this code sucks. I am trying since this morning to make it working but nothing.
    My pc alway goes down and i need to restart