excel vba - VBA VBProjects Run Commands -
i trying use late binding in below code kick of stored public function exists in bound excel file can't seem remember or figure out object type should using. got rush , ended using below open , call code other spreadsheet. background have userform allows people schedule programs run @ night on different time intervals. worry below end being buggy @ point.
any suggestions on object or how improve section of code within else statement?
sub runexcel() dim oxlapp object dim lpath string dim wrtpswd string dim vbproj vbide.vbproject 'lpath = "c:\\support\manalyze.xlsm" lpath = sheets("nightly determinations").cells(fl, 3) wrtpswd = sheets("nightly determinations").cells(fl, 6) pflop = sheets("nightly determinations").cells(fl, 7) if pflop = "" set oxlapp = createobject("excel.application") oxlapp.visible = false set wb = oxlapp.workbooks.open(filename:=lpath, readonly:=false, writerespassword:=wrtpswd, ignorereadonlyrecommended:=true) wb.refreshall wb.save wb.close (false) oxlapp.quit else workbooks.open filename:=lpath, readonly:=false, writerespassword:=wrtpswd, ignorereadonlyrecommended:=true x = activeworkbook.name workbooks(x).activate run "'" & x & "'!" & pflop workbooks(x).close (true) end if end sub
Comments
Post a Comment