I writed a macro to get the status of the checkbox.But I encountered a little problem when running it on blueprism.
My macro name PERSONAL.XLSB!CheckBox.I can manually execute it successfully.enter image description here
But I got an error reminder when I run the Run Macro via blueprism.enter image description here
error message:The code stage could not be executed because an exception was thrown by the code stage. The macro '' PERSONAL.XLSB! 'CheckBox' cannot be executed. Macros may not be available in this workbook, or all macros may be disabled.
The methodology that Blue Prism uses when launching Excel does not automatically open the current user's PERSONAL.XLSB file.
There are three options to rectify this:
Open the current user's personal macro-enabled workbook using the MS Excel VBO's Open action, pointing the File attribute to the location of PERSONAL.XLSB. In environments running Windows 7 or later, this is usually C:\Users\<user name>\AppData\Local\Microsoft\Excel\XLStart (source). You should then be able to reference the macros as you have been with the Run Macro action within the MS Excel VBO.
Copy the pertinent macros to the file in question before processing it with Blue Prism, and invoke them simply by name using the Run Macro action of the MS Excel VBO.
Add the macro code to a modified version of the MS Excel VBO, refactoring per Blue Prism's official guidance on Extending the MS Excel VBO.
Related
I'm following the methods of this Mathworks post (but using Octave 6.2.0 instead of Matlab)
https://www.mathworks.com/matlabcentral/answers/100938-how-can-i-run-an-excel-macro-from-matlab
to open an Excel file (Office 365 version) and execute a macro. It works very well to a point (i.e. on a test Excel file containing a test macro). However, in practice I'm using the xlsopen(...) , oct2xls(...), and xlsclose(...) functions in Octave to create the Excel file I ultimately want to use, so I think I either have to...
(a) use Octave to create an Excel file containing a VBA macro, or
(b) adapt one of the options in the Mathworks post to be able to run a macro from the 'PERSONAL.xlsb' workbook instead. I've tried changing the 'Macro1' name to PERSONAL.xlsb!Macro1 (with 'Macro1' coded into a module within the personal workbook) but this does not execute the macro and gives the following error in Octave:
error: com_invoke: property/method invocation on the COM object failed with error `0x80020009' - Exception occurred.
Invoking the macro coded into the personal workbook directly from the active workbook is successful (even if it's a different workbook), I just need Octave to do this step.
Are either of these possible to do, or is there another alternative? Thanks in advance.
I am currently working on creating my own Ribbon in excel. I wrote out the specific code in a module in a macro-enabled workbook that I will subsequently save as an Excel add-in (.xlam). However, whenever I try to run the module in my macro enabled workbook, the select macro window appears and no code is executed (see picture for reference). Subsequently, I think this is what is also causing my ribbon button to give the following error when clicked "The macro may not be available in this workbook or all macros may be disabled."
Any help/suggestions would be appreciated. Thanks.
I have many Excel templates containing VBA code. Some of them create new documents based on other templates with VBA code. They all worked well until last Friday, but today I got a bad surprise: creating the first document based on a template with macro works well, but creating the second gets corrupted code.
I was able to reproduce the problem with two very small templates created from scratch:
double click on the first file to create the first document
double click on the second one to create another document
At this point you can see on the VBA editor that the VBA project for the second document is corrupted. Signs of corruption are wrong icons on the Wrokbook and Worksheet modules on the project explorer and message about catastrophic failure if you try to compile.
Using first the second template, then the first one will corrupt the second one that is opened.
Click here to get the files to reproduce the problem.
EDIT
If you don't want to download the files (I understand, thanks to the comment #Mathieu Guindon) you can create them by simply:
create a new Excel file
add a module with a simple sub that shows a message box
save it as a template with macro
repeat with a second file
Now you have the two files that you can use to reproduce the problem described above.
Microsoft has confirmed that the build 1905 is broken and corrupts the second Excel document created from a template with macros.
They sent me a (long) list of steps to uninstall Office 365, run a script to clear some cache, create a new configuration and reinstall specifying the semi-annual channel for the updates and prevent the 1905 from being installed.
Excel 2019 MSO (16.0.11629.20210) 32-bit.
=== Tested: Opening sequence and filetypes ===
• FAIL - Open an Excel template that contains VBA, then another one that contains VBA.
• OK - Open an Excel template that contains VBA, then Excel template with no code in any module.
• OK - Open an Excel template that contains VBA, then an XLSB (Excel binary file) that was created by resaving any of the previous code-containing workbooks.
=== Tested: VBA Editor's Immediate window ===
• FAIL - In VBA Editor, open a code module from the second or any subsequent workbook that has VBA in it, then run a command in the Immediate window.
• OK - In VBA Editor, open a code module from the first workbook, then run a command in the Immediate window.
=== Couldn't find any MS article about it. ===
Not listed on https://support.office.com/en-us/article/fixes-or-workarounds-for-recent-issues-in-excel-for-windows-49d932ce-0240-49cf-94df-1587d9d97093 but it's definitely an Excel issue:
Can't open more than one macro-enabled workbook and have macros actually run, unless the 2nd and all subsequent macro workbooks are .XLSB.
Even with no addins loaded.
Symptoms:
• Excel is configured to allow macros, but no macros run.
• Excel is configured to prompt for macros, but doesn't.
• Attempting to run a macro in workbooks after the initial workbook causes Catastrophic Error, Automation Error, or Compile Error.
I currently have an Excel Macro saved in the personal workbook that I would like to run when opening a file with the task scheduler. Right now I am able to get the workbook to open and then it cannot find the macro that it is trying to run. I am using the "/x MACRONAME" Argument to try and run the macro currently and I am afraid that I can't figure out the correct name. I have tried just using the macro's name and PERSONAL.XBLS! followed by the macro's name. I feel like I am missing something very obvious and any help would be appreciated.
within ms access office 365, how can I execute a macro.
I don't see a run button in the ribbon tool-bar as I would see normally. So how can i execute the macro and also hints on how to debug the macro if can run
If you open the file with the desktop version of Office then the macros should still work. If you are opening from a browser or web application, then the macros will not be available.
At the point we were developing this, there was no option to write VBA macro code in Access 365. So we used the macro designer surface to create the macro. Once the macro was created, to execute the macro, we created a form and put a button. On the click event of the button we attached this macro to be executed. All these needs to be done through a designer surface. There was no in-line code option
A hint which I learnt, the macro should run under a minute, else the macro will get terminated. So optimize the macro to the best. A technique we used to get around this problem was to split the long running macro into smaller macro's and call each macro one after the other.