A question about Power Automate to proceed macro from another excel file - power-automate

Hello I am a newbie that working on a project that requires to use Power automate desktop to analyze data in the excel worksheet. The project needs me to download a excel file from website and proceed with macro. Now I am able to download file from website and macro script has been tested without problem. So here comes the problem, I couldn't figure out how to use power automate to run macro from another excel file.
So let's say there are two excel file a.xlsm and b.xlsm and both store in download folder. The a.xlsm will always been the download file from website and b.xlsm will be the file that I already store the macro. I need to open a.xlsm and run the macro store in b.xlsm. Thanks for any suggestion in advance.

Ok I figure it out, here is the step you may follow.
Record Macro
Stop recording the Macro
Click Macros under developer section (or press Alt + F11)
Find the Module 1 under VBAProject (PERSONAL.XLSB (Default name))
Copy your finished script and paste into the module1
In the run excel macro function in Power Automate Desktop, put that code after Macro: 'PERSONAL.XLSB'!**** (**** will be the macro function you want to run)
note: please remember every time you want to run the macro you have to open the original worksheet which contains the macro, otherwise you won't be able to run it

Related

Create executable to run a shortcut? Similar to a .bat file but a .exe?

I have a keyboard with 6 keys I can assign pretty much anything to, including opening apps.
I want to be able to open Spotify with one of these keys, but I have to have to link a .exe to to the key - no other file type will work.
I have Spotify downloaded from the Windows Store, so it's stuck under the WindowsApp folder in Program Files, which means I can't access it directly. Even if I create a shortcut and put it on the desktop, it's not an .exe, it a .lnk.
I'm wondering if there's a way to create a .exe file that will run the Spotify shortcut that I have on my desktop, or any app at all.
I know it sounds redundant - creating a .exe to run a .exe - but I can't access the WindowsApp folder to directly link it to my keyboard. I know a batch file would work, but I can't link a .bat to my keyboard, only .exe.
I don't have experience creating executables, so I don't even know where to start and I haven't been able to find anything online.
If you wish to try this yourself, you will need to:
install a compiler
write the code
use the compiler to create an executable
While this might sound complicated for somebody without experience, in this case is not that hard.
Here is how you can do it using the very simple PureBasic compiler:
download and install the PureBasic compiler from this website
https://www.purebasic.com/download.php
(the demo version is fine, it will do the job)
choose [PureBasic-Demo.zip (x64 - 64 bit)]
launch the PureBasic IDE and write this code:
in this example I'm making an executable which will launch Sublime Text, so change the path to your Spotify executable
```
; // make this a console program
OpenConsole()
; // specify path to another executable
pathToExecutable$ = "C:\Program Files\Sublime Text 3\sublime_text.exe"
; // use RunProgram to launch another executable
x = RunProgram(pathToExecutable$)
```
after you enter the code, click on File menu at the top, then click on Save As..., you will be prompted for a name for your source code file.
select a location, for example your Desktop then, enter a name for the file, for example proxy. (this will create a proxy.pb file)
last step, create the proxy.exe executable
click on Compiler menu, then click on Create Executable...
select location (again I recommend your Desktop), then enter a name for the executable, again for example proxy and then click on Save (this will create proxy.exe on your Desktop)
You can move your new created executable anywhere, it's portable.
Good luck!
This is Stack Overflow where you can do it yourself so here is how.
Download a BAT to EXE convertor from here or here.
Make a batch file to start the program of your choice. (Code would look like the following)
#start "" "C:\users\JimithyJones\Desktop\Spotify.exe" && exit
Convert it to an EXE with one of the previous programs. WARNING! Sometimes they are detected as malicious files because batch files have the capability to do harm to your computor.
Assign the new EXE to your hotkeys.

Windows 7: Right click on file and run custom Excel VBA script

I wrote a macro in Excel VBA that can scrape files with an .f06 extension for certain data and then creates a spreadsheet that summarizes the data.
It is inconvenient to have to find the Excel workbook, open it, run the macro, & select the .f06 file to generate this summary.
I prefer to right-click on the .f06 file directly and have an option called 'scrape' that I could select and then it would run the code automatically.
1) Is this possible?
2) Can I use the existing macro-enabled Excel spreadsheet as the referenced code? Or do I need to re-write it in another language?
I am using Windows 7 Enterprise SP1 if relevant.
Thank you.
This is possible, but if you're on a company computer, I doubt that you'll be able to do some of the required steps.
1) write a VBScript for your macro according to the following guide:
http://wellsr.com/vba/2015/excel/run-macro-without-opening-excel-using-vbscript/
2) Launch the VBS you wrote in Step 1 from the right click menu, according to the following guide:
http://www.visualbasicscript.com/Launch-vbs-from-the-rightclick-menu-advanced-m32062.aspx
Best of luck!

How to call a function when opening program from file?

I made a project in visual studio 2010 (maybe a bit outdated but I like it this way).
With that project I made a separate project that handles the setup file for the installation. In this setup project I assigned a file type to my project so that the program can be started by double-clicking the file.
Now all of this works, the file gets a icon similar to the program and when I double-click it, the program opens. The only problem is that it doesn't open the file that was clicked.
I think I need to change something in the 'command' that is seen in the file type properties. As it is, I just have it set to "Primary output form Project 1". How can I make it so that it doesn't just open the program, but also calls a function that loads the data inside the file?
I'm sorry if this question has been asked before. I searched for it but I couldn't find a similar question. I'm also pretty new to the whole programming thing.
Thank you in advance!
You want to pass the filename to your program as a command line argument.
Add %1 to the end of the command you have associated with the file extension.
For example: "C:\path\to\MyProgram" "%1"

VB script to open .exe file and perform 4 activities

I have a tool based on .net. I need a vb script which would open this tool (.exe file) and then select 3 radio buttons, click on a button to browse a xml file stored in same folder and then click on invoke button. Is this possible? I am a complete fresher and just have this idea in mind for an automation. This is required as I have to perform the same steps daily.
I could find this code:
CreateObject("WScript.Shell").Run("""C:\Users\abc\Desktop\folder\Tool.exe""")
Which is doing my task to open the .exe file perfectly. Can someone help/guide me in achieving the further steps?
You might be better off making your tool work via the command line and having it accept arguments.
That way, you could use a .bat file to call your 'tool' passing in the arguments it needs and away you go.
These should get you started on your quest.
Creating a HelloWorld Console Application Using VisualBasic.NET
How to Parse Command Line Parameters?
What is a bat file

Windows batch command question, start excel temp.xls

I wanted to know that if I do
start excel temp.xls
The os will start a new excel instance and open the workbook temp.xls in that instance, AS AN ATOMIC action.
Right now what I have is
start excel
start temp.xls
And most often these two command will mess up my other excel instance, ie, opening temp.xls in another excel instance that has another workbook already opened.
Thanks,
While I think that "start excel temp.xls" will open temp.xls in the Excel instance started by start, you'd be on the safe side, if you use
"<PathToExcel>excel" [/<opt>] "<PathToXls>temp.xls"
For opt see cli for excel (pick the docs for your version).
The Command-line switches for Excel 2007 document explains the switches:
You can change certain aspects of how
the program starts by adding
subcommands called switches to the
Excel.exe command. A switch appears as
a space after the main command,
followed by a slash mark (/) and the
name of the switch. The switch is
sometimes followed by another space
and then one or more specific
instructions called parameters, which
give the program further information
about how to execute the Excel.exe
command.
In your case you do not use a switch but a parameter. It is used to give the program further information about how to execute the Excel.exe command.
Parameter: file name
Description: starts Excel and opens the specified file.
So I would assume that the parameter is bound to the excel instance started.

Resources