Hello,
I created a macro to open up a file location, move to the search box, paste text that was entered through an input box, then select the file and open it (a pdf). I am having issues where it doesn't actually enter the Windows Explorer when it opens it and ends up pasting the MO text in the excel sheet. It works about half the time. The code is pasted below.
Thanks for your help in advance!
-MK
I created a macro to open up a file location, move to the search box, paste text that was entered through an input box, then select the file and open it (a pdf). I am having issues where it doesn't actually enter the Windows Explorer when it opens it and ends up pasting the MO text in the excel sheet. It works about half the time. The code is pasted below.
Thanks for your help in advance!
-MK
Code:
Sub MO_Lookup()
MO = InputBox("Enter the MO: ")
a = 0
Do Until a = 1
Shell "explorer.exe" & " " & "C:\Users\name\Documents\MOs", vbNormalFocus
Application.Wait (Now + 0.00001)
Application.SendKeys "{TAB}"
Application.Wait (Now + 0.00001)
Application.SendKeys "{TAB}"
Application.Wait (Now + 0.00001)
Application.SendKeys "{TAB}"
Application.Wait (Now + 0.00001)
Application.SendKeys MO '
Application.Wait (Now + 0.00001)
Application.SendKeys "~"
Application.SendKeys "{DOWN}"
Application.SendKeys "{UP}"
Application.SendKeys "~"
a = 1
Loop
End Sub
Last edited by a moderator: