Python: hide Open File Dialog when running Excel macro -


i'm writing python script automate process uses excel macros format files input different program later on. i'm bit new python , new vba, think have steps down.

so far have run macro (with other posts):

xl = win32com.client.dispatchex('excel.application') xlpath = os.path.expanduser(xlfile) wb = xl.workbooks.open(filename=xlpath, readonly=1) xl.run("my_macro") 

at point macro runs , calls application.getopenfilename() open dialog user choose file formatted, going different each macro.

basically user going have different initial data format each time run script. @ beginning want them choose files need formatted , i'll save file paths. i want plug file paths macro python instead of opening dialog in excel.

is there way directly changing macro? if not, need rewrite macro in python 1 of modules out there driving excel?

it looks can call xl.run("my_macro") parameters have figure out how macro reads in parameters once pass in paths can open files without dialog.

xl.run("my_macro", path1, path2) 

https://stackoverflow.com/a/16740500/3788802


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -