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.
Related
I am looking to write a macro to have in my Personal Macro Workbook that will be able to be activated and run a series of Find/Replace's both on the worksheets of any Spreadsheet I have open and within the VBA of any macros inside that spreadsheet. The worksheets part of this is easy, but I cannot find a way to do it to the Visual Basic Editor, and trying to record the macro seems to not pick up anything done in VBA. I do not care if the code is clever enough to go through every VBA module or it needs to go "module1", "module2" and so on and run the find/replaces for each module seperately (because I guarantee that none of them are named otherwise); but so far, I have not been able to find anything that works and does an automatic find/replace in Excel VBA.
If it helps as an example, I am looking to change any reference in the VBA of "" to "/"
Thanks
I have found something online about using VBINDE to change constants; but I haven't been able to modify it to change text as above.
I realize this is probably a simple task but I am having issues activating files in my code. I need to have the user choose a file from a pop-up box, have the file opened, and then be able to rename the file so I can activate it periodically in my macro without worrying about the file name being different each time the macro is run.
I am relatively new to VBA and am taking a course online to get better. I would appreciate any help with this.
Thanks.
Normally you don't need or want to Activate or Select - see this question for a thorough explanation why not and how to avoid doing so.
In your case, when you are opening the workbook, capture the result in a workbook variable:
Dim wb as Workbook
Set wb = Workbooks.Open(...)
Now you don't need to refer to the file by name at all.
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.
I have a need to build a macro in Excel 2010 that basically runs continually (started by button or stopped by button) that looks into a file folder. If a file is created there and named a certain way then the macro opens it and processes the data inside. The file is then closed and deleted. The macro then continues on to watch the file folder for more files to process
Is this a reasonable / doable macro that I could create in Excel with VBA? Can VBA continually run without issues?
Best Regards
Andy
Is your program continuously pulling changing data from the Excel sheet? If not, I would advise creating the program in another language and running in a continuous loop containing your code and the sleep() function. If so, then I would recommend using the worksheet change event, and you cannot edit the worksheet while a macro is running(even if you use the sleep/wait command in VBA)
This link might also prove helpful: How to get VBA Macro to run continuously in the background?
see this thread for some ideas:
https://superuser.com/questions/226828/how-to-monitor-a-folder-and-trigger-a-command-line-action-when-a-file-is-created
the first answer probably will do it, just trigger the excel macro you want from that. You can get as fancy as you want with the execution. The application.ontime function only works if excel is open, I believe.
What you want is to find a way to monitor the folder constantly.
I am using Excel 2007 (32Bit) on a Windows 7 64Bit machine.
I have a large Workbook with 12 sheets and 18 VBA modules.
All of my subroutines run flawlessly but one is causing the following issue:
The macro itself runs from start to finish successfully just as specified. After running the macro successfully, the workbook crashes, when I try to save it. It also crashes when AutoSave tries to save the workbook. The workbook does not crash when I simply close it.
By crashing, I mean that I get the message "Microsoft Office Excel has stopped working".
In the Windows Event Viewer I have identified the error message 0xc0000005.
In the folder where the workbook is saved, I find the temporary files that Excel creates when saving a workbook (named something like 9BB7B000).
I have tried to repair Excel in the Programs and Features part of the Control Panel but it has not worked. Furthermore no Add-Ins are enabled.
I suspected that the code module of the problem-causing macro was too large (90KB) so I split it up into two modules smaller than 64KB. However, the problem remains.
I would appreciate any help on this issue. I would like to get around reconstructing the workbook manually, if possible, as that would mean an enormous effort.
Thank you very much in advance.
Jochen
I had the same issue some time ago and carried out a research to identify the issue to no avail.
I noticed that it worked fine on workstations with better procs and more ram.
However the only way for me to proceed was to create a new workbook a one-by-one copy each worksheet from the old workbook and see which one is causing the issue. If the macro is causing the error then try to add a "sleep" command between loops so that the Excel file regains control and can execute and awaiting events/commands.
The post was 9 months ago, could you fix it?
What does that specific macro do? Because there are several solutions to this problem.
It seems that a certain "action" in your macro takes too long.
You can search for that specific action and us application.wait to slow your macro down. If this doesn't work, you'll have to find a way to reduce the "workload". But to do that, i'll need to take a look at your code.
Turn off the AutoSave function in Excel Options