Тёмный

How to automate File Uploads using excel macros 

Automation Made Easy
Подписаться 17 тыс.
Просмотров 30 тыс.
50% 1

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...

Опубликовано:

 

4 авг 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 143   
@arvinthnair2856
@arvinthnair2856 3 года назад
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!
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
Glad it helped!
@TanveshDabholkar
@TanveshDabholkar 4 года назад
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.
@AutomationMadeEasy
@AutomationMadeEasy 4 года назад
Glad you liked it
@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.
@AutomationMadeEasy
@AutomationMadeEasy Год назад
Glad to hear that
@rpregis2able
@rpregis2able 3 года назад
Amazing ...much benefited from these tutorials. Thank you
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
Happy to hear that!
@ElWiwif
@ElWiwif 2 года назад
Love you buddy! Thanks for sharing your amazing inputs!! Cheers to you!
@AutomationMadeEasy
@AutomationMadeEasy 2 года назад
My pleasure!
@GregMontiel
@GregMontiel 3 года назад
Sin mentir, pase mas de 12 horas buscando alternativas para poder realizar esto, muchas gracias por este truco super genial. Saludos.
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
thank you
@user-reckon_
@user-reckon_ 2 года назад
OMG!! Thank you so much!!! I wasted too much time to search this solution!
@AutomationMadeEasy
@AutomationMadeEasy 2 года назад
No problem!
@Amangupta-kj8vw
@Amangupta-kj8vw 4 года назад
Thanks a lot ! It's very helpful 😁
@AutomationMadeEasy
@AutomationMadeEasy 4 года назад
You're welcome!
@muralikrishnanayyappan6513
@muralikrishnanayyappan6513 2 года назад
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 !
@AutomationMadeEasy
@AutomationMadeEasy 2 года назад
Glad it helped!
@tishamurvihill3903
@tishamurvihill3903 2 года назад
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.
@AutomationMadeEasy
@AutomationMadeEasy 2 года назад
Your welcome
@shishirjoshii2844
@shishirjoshii2844 3 года назад
Really awesome, thanks for sharing.
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
Thanks for watching!
@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.
@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 года назад
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.
@vaibhavpatil7227
@vaibhavpatil7227 4 года назад
thanks sir for this video. i requesting you to please prepare video for download file with dynamic path.
@AutomationMadeEasy
@AutomationMadeEasy 4 года назад
welcome
@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
@jackwhite801
@jackwhite801 3 года назад
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
@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
@juanoviedo587
@juanoviedo587 Год назад
Excellent Work !! Congratulations, Where can i have to source code ? Thanks !
@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
@AutomationMadeEasy
@AutomationMadeEasy 2 года назад
Thanks
@elricho72
@elricho72 2 года назад
Great Video, and how can I upload with VBA on google Drive ?
@anjarsaputra7909
@anjarsaputra7909 3 года назад
I have an error' out of range because WsScript.arguments(0), how to solve it
@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 года назад
we need to wait for the element to be visible or in some cases the element to get enabled.
@LoudFindings
@LoudFindings 5 лет назад
बेस्ट
@AutomationMadeEasy
@AutomationMadeEasy 5 лет назад
thank you
@_.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.
@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?
@vijaykolambe3917
@vijaykolambe3917 3 года назад
Hi, Can this code take the file path from excel worksheet and upload multiple files ?
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
Yes, you can
@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 года назад
Refer below tutorial for web automation using chrome: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE--GUw22ecRwI.html For file upload automation use the same techhique as explained or copy the vbs script code in moacro module. It will work
@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
@abkhan2262
@abkhan2262 5 месяцев назад
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 5 месяцев назад
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
@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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-AEp0Yeis9AM.html Apply the sam logic for file upload. The script is provided in the blog itself.
@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
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
yes it does not work with spaces
@rameshgohil1984
@rameshgohil1984 2 года назад
Shell"wscript.exe " & strFile & " " & strUploadFile (showing compile error and syntax error) please help
@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 года назад
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
@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 года назад
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
@egyadyafahrezy1214
@egyadyafahrezy1214 Год назад
How to do the loop then?
@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.
@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
@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
@nitinsuryawanshi8601
@nitinsuryawanshi8601 4 года назад
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
@kangamo7944
@kangamo7944 3 года назад
I've tried selenium vba but it doesn't work
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
what error are u getting?
@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 года назад
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
@balajiprasath3895
@balajiprasath3895 4 года назад
Its opening but not uploading
@LoudFindings
@LoudFindings 5 лет назад
Tell us about that shell vba file, any ur tutorial link. Please
@AutomationMadeEasy
@AutomationMadeEasy 5 лет назад
its there on the blog used for the tutorial
@kryptonrules
@kryptonrules 4 года назад
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.
@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 года назад
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.
@anjarsaputra7909
@anjarsaputra7909 3 года назад
Hi , i tried the code but when the dialog box opens to select path, the path didnt got copied or paste.
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
share ur code
@anjarsaputra7909
@anjarsaputra7909 3 года назад
@@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 3 года назад
Sometime it works but i try again it didnt work, it appears only "v"
@AutomationMadeEasy
@AutomationMadeEasy 3 года назад
try increasing the delay
@anjarsaputra7909
@anjarsaputra7909 3 года назад
@@AutomationMadeEasy delay on vba or in vbscript?
@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?
@JK-hm3lf
@JK-hm3lf 4 года назад
Shell line in vba module giving syntax error. ☹
@AutomationMadeEasy
@AutomationMadeEasy 4 года назад
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.
@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
@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
Далее
How to Create & Use Excel Macros (Real world example)
10:09
ТЫ С ДРУГОМ В ДЕТСТВЕ😂#shorts
01:00
How to Automate Web Scraping Using Excel Macros
26:57
How to Create and Use Excel Macros 😎
13:43
Просмотров 47 тыс.
Learn Excel VBA to Automate Anything
14:02
Просмотров 392 тыс.
How to Automate Edge Browser using Excel Macros
20:03
Excel VBA - Write a Simple Macro
3:25
Просмотров 1,1 млн