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)
Comments
Post a Comment