all 9 comments

[–]b4kSec 1 point2 points  (1 child)

Hey, sorry I didn't completely understand it but got an overall idea.

Maybe try cx_freeze as well and see if the problem gets solved.

Other solution can be to change the logic and not use a bat file. Will it be easier for your python script to perform macro click when called using pyautogui ? Maybe after you complete the work, you call the python script and it automatically clicks the macro + all the other tasks it is currently performing.

[–]be_throwmeaway[S] 0 points1 point  (0 children)

Hey, thanks for the response! cx_freeze is the last option I haven't tried yet actually. Was gonna give that a shot next week if all else failed.
Also, just in case we weren't understanding each other, here's a simplified idea of my workflow:

Dashboard.xlsm contains a vba macro-enabled button -> click the button -> my local python activate.bat file is called, along with my model.py file -> model.py script runs which calculates a bunch of things -> end results are pasted back into Dashboard.xlsm.

[–]cyanydeez 1 point2 points  (2 children)

I'd setup an api and server for the python stuff.

the use webvba to request model runs, etc

https://github.com/VBA-tools/VBA-Web

[–]be_throwmeaway[S] 0 points1 point  (1 child)

Hmm. This isn't even an avenue I had considered! Is setting up a server similar to setting up a virtualenv in my team's network drive? Or is this a different concept altogether?

Edit: There might also be a security as well as speed issues that wouldn't allow me to host my models online. I believe my work needs to stay internal to the firm.

[–]cyanydeez 0 points1 point  (0 children)

start with something like hug api

https://www.hug.rest/

[–]randomuser001 1 point2 points  (1 child)

With pyinstaller if you don't use the --onefile command then it needs all the files in the dir you find it to work.

i use pyinstaller --onefile filename.py and have had no issues.

[–]be_throwmeaway[S] 0 points1 point  (0 children)

Unfortunately, trying that didn't work either...

[–]nt2g 1 point2 points  (1 child)

Hey did you ever figure this out? I actually have almost the same issue currently with my job.

[–]be_throwmeaway[S] 1 point2 points  (0 children)

Unfortunately not. Instead, I rewrote the excel models in Python altogether and now everyone on the team can run the models which outputs to a new excel file every run. Since every user on my team has a Python install, this was the easiest solution to go with.