vba - How do I automate the Import Data form or stop it from prompting me? -


edit: feel such idiot, 2 days of headaches playing around vba mouse positioning , window focus title name , time didn't need macro .isy download / import. have found out can refresh data connection part of macro. feel free still answer below if know how or tempted problem (i'll go once project done, don't defeated) no longer needed.

so i've automated ie .click 'export excel' on sharepoint in new excel workbook (for security our organisation has disabled visual basic sharepoint).

i have used .sendkeys interact first message box , used nasty settings shut data connections security warning up.

that leaves import data form deal with:

the hurdle

when try use .sendkeys imitate return or spacebar, keypress happening elsewhere, whether in code when developer open or in application when not.

i have tried select sheet1 if manually form gain focus.

any ideas how can automate control of form or force gain focus .sendkeys work?

for clarity, here's full code:

sub export()      application         .screenupdating = false         .calculation = xlcalculationmanual         .displayalerts = false         .enableevents = false     end      dim ie object     set ie = nothing      set ie = createobject("internetexplorer.application")     ie.visible = true      ie.navigate "site cannot disclosed"      until (ie.readystate = 4 , not ie.busy)     doevents     loop      dim list      set list = ie.document.getelementbyid("ribbon.list-title").getelementsbytagname("a")(0)      list.click     'list.fireevent ("onclick") alternative      until (ie.readystate = 4 , not ie.busy)     doevents     loop      dim export      set export = ie.document.getelementbyid("ribbon.list.actions.exporttospreadsheet-large")     export.click      application.wait (now + timevalue("00:00:01"))     application.sendkeys "%{o}" 'works here need make focus change before next keypress      workbooks("reporting macro").sheets("sheet1").select     application.wait (now + timevalue("00:00:01"))     application.sendkeys " "      end sub 


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -