Microsoft
Software
Hardware
Network
Question : SendKeys in mex file
Hey-- I have an Excel workbook containing macros that needs to be opened and run automatically with a Matlab EXE file. I have the VBA macros in an Auto_Open sub so that they are run immediately upon the opening of the workbook, and I've written Matlab code that automatically opens the Excel workbook. The problem is, when Excel opens, the "Enable or Disable Macros" prompt pops up, and it has to be clicked out of manually in order for the workbook to be opened and the macros to automatically run. The normal way around this is apparently to set the Macro Security level to "Low" which results in the workbook automatically being open with the macros enabled, but due to security settings on my computer I am unable to change the Macro Security level to anything lower than Medium.
In order to programmatically get past the prompt with macros enabled, it occurred to me that all that one would theoretically have to do is press "Tab" to select the "Enable Macros" button, and then "Enter" to get past the prompt, and that this could programmatically be done with the Matlab analog of the VBA "Sendkeys" function. After researching this, I can't find anything in Matlab that replicates the functionality of SendKeys, but it looks like it's actually possible to do in either C or C++, which can then be written into a mex file and executed in Matlab. I'm not really understanding how Sendkeys works in C/C++, though... is it possible to have C/C++ automatically press Tab,Enter in a mex file?
Any help will be greatly appreciated!!
Answer : SendKeys in mex file
SendKeys isn't VBA, it's VBS.
If you need it to work, then write a VBS file with the proper sendkeys stuff in it, save it as a VBS, and then have matlab call that file instead of a C/++ executable.
HTH,
exx
Random Solutions
Training Path
Create a list of users in Active Directory whose account has been locked out for 90 days
SBS 2008 Outlook Anywhere SSL Issue
How to Get Specific Button pressed in a repeater when using ModalPopupExtender
Silverlight 4 Async_ExceptionOccurred
DR solution for data warehouse
Terminal Server Printing
HP 6930p,8440p Hanging at BIOS screen
If folder does not exist, then create one
Http dynamic Compression not work if We using text/html