<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932</link>
    <title>MATLAB Central Newsreader - Disable Excel Macro</title>
    <description>Feed for thread: Disable Excel Macro</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 06 Jan 2009 09:54:02 -0500</pubDate>
      <title>Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620037</link>
      <author>Alex Thiele</author>
      <description>Hi all,&lt;br&gt;
&lt;br&gt;
I have a script which interogates hundreds of .XLS files using XLSREAD. However, these XLS files all have macros which display a pop up window if macros are enabled.&lt;br&gt;
&lt;br&gt;
This means that I have to sit at the computer closing all the pop up windows as they appear, rather than just being able to set the program off and walk away.&lt;br&gt;
&lt;br&gt;
Does anyone know of a way in which I can disable these macros from my MATLAB script, or close the pop up windows as they appear?&lt;br&gt;
&lt;br&gt;
Many thanks,&lt;br&gt;
&lt;br&gt;
Alex</description>
    </item>
    <item>
      <pubDate>Tue, 06 Jan 2009 10:14:02 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620039</link>
      <author>Aslak Grinsted</author>
      <description>&quot;Alex Thiele&quot; &amp;lt;bert1234@yahoo.com&amp;gt; wrote in message &amp;lt;gjv9nq$1v8$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have a script which interogates hundreds of .XLS files using XLSREAD. However, these XLS files all have macros which display a pop up window if macros are enabled.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This means that I have to sit at the computer closing all the pop up windows as they appear, rather than just being able to set the program off and walk away.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does anyone know of a way in which I can disable these macros from my MATLAB script, or close the pop up windows as they appear?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Many thanks,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Alex&lt;br&gt;
&lt;br&gt;
can you use 'basic' mode: (quote from help xlsread)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[NUMERIC,TXT,RAW]=XLSREAD(FILE,SHEET,RANGE,'basic') reads an XLS file as&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;above, using basic input mode. This is the mode used on UNIX platforms&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;as well as on Windows when Excel is not available as a COM server.  &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;In this mode, XLSREAD does not use Excel as a COM server, which limits&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;import ability. Without Excel as a COM server, RANGE will be ignored&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;and, consequently, the whole active range of a sheet will be imported. &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Also, in basic mode, SHEET is case-sensitive and must be a string.</description>
    </item>
    <item>
      <pubDate>Tue, 06 Jan 2009 10:51:02 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620044</link>
      <author>Alex Thiele</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
Thank you for your reply.&lt;br&gt;
&lt;br&gt;
Unfortunately I get the error message:&lt;br&gt;
&lt;br&gt;
Warning: XLSREAD has limited import functionality on non-Windows platforms&lt;br&gt;
or in basic mode.  Refer to HELP XLSREAD for more information.&lt;br&gt;
&amp;gt; In xlsread at 200&lt;br&gt;
??? File contains unexpected record length.  Try saving as Excel 98&lt;br&gt;
&lt;br&gt;
Thanks again,&lt;br&gt;
&lt;br&gt;
Alex</description>
    </item>
    <item>
      <pubDate>Tue, 06 Jan 2009 11:36:16 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620049</link>
      <author>ImageAnalyst</author>
      <description>Warnings are not errors.  You can probably ignore it.  The important&lt;br&gt;
things is, do you get the file created that you expected?</description>
    </item>
    <item>
      <pubDate>Tue, 06 Jan 2009 11:56:02 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620053</link>
      <author>Alex Thiele</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
No I don't.&lt;br&gt;
Actually the full error message is&lt;br&gt;
&lt;br&gt;
&amp;gt; In xlsread at 200&lt;br&gt;
&amp;nbsp;&amp;nbsp;In SpreadsheetAnalyser&amp;gt;pushbutton1_Callback at 147&lt;br&gt;
&amp;nbsp;&amp;nbsp;In gui_mainfcn at 75&lt;br&gt;
&amp;nbsp;&amp;nbsp;In SpreadsheetAnalyser at 48&lt;br&gt;
??? File contains unexpected record length.  Try saving as Excel 98.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; SpreadsheetAnalyser&amp;gt;pushbutton1_Callback at 147&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[WholeDataFile,txt] = xlsread([Pathname,Filename{1,counter}],'ATP results','A1:U146', 'basic'); %import data and delete unwanted rows and columns&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; gui_mainfcn at 75&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;feval(varargin{:});&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; SpreadsheetAnalyser at 48&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gui_mainfcn(gui_State, varargin{:});&lt;br&gt;
&lt;br&gt;
??? Error while evaluating uicontrol Callback.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I didn't post this bacuase I didn't think it contained useful information. But I could be wrong. If I remove the 'A1:U146', 'basic' from my XLS read statement, then it works, but with the macro problem, Adding the 'A1:U146', 'basic' gives me the error above.&lt;br&gt;
&lt;br&gt;
Thanks again&lt;br&gt;
&lt;br&gt;
Alex</description>
    </item>
    <item>
      <pubDate>Tue, 06 Jan 2009 13:50:18 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620070</link>
      <author>Andrew</author>
      <description>On Jan 6, 4:56=A0am, &quot;Alex Thiele&quot; &amp;lt;bert1...@yahoo.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; No I don't.&lt;br&gt;
&amp;gt; Actually the full error message is&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; In xlsread at 200&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 In SpreadsheetAnalyser&amp;gt;pushbutton1_Callback at 147&lt;br&gt;
&amp;gt; =A0 In gui_mainfcn at 75&lt;br&gt;
&amp;gt; =A0 In SpreadsheetAnalyser at 48&lt;br&gt;
&amp;gt; ??? File contains unexpected record length. =A0Try saving as Excel 98.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in =3D=3D&amp;gt; SpreadsheetAnalyser&amp;gt;pushbutton1_Callback at 147&lt;br&gt;
&amp;gt; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 [WholeDataFile,txt] =3D xlsread([Pathname=&lt;br&gt;
,Filename{1,counter}],'ATP results','A1:U146', 'basic'); %import data and d=&lt;br&gt;
elete unwanted rows and columns&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in =3D=3D&amp;gt; gui_mainfcn at 75&lt;br&gt;
&amp;gt; =A0 =A0 =A0 =A0 feval(varargin{:});&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in =3D=3D&amp;gt; SpreadsheetAnalyser at 48&lt;br&gt;
&amp;gt; =A0 =A0 gui_mainfcn(gui_State, varargin{:});&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Error while evaluating uicontrol Callback.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I didn't post this bacuase I didn't think it contained useful information=&lt;br&gt;
. But I could be wrong. If I remove the 'A1:U146', 'basic' from my XLS read=&lt;br&gt;
&amp;nbsp;statement, then it works, but with the macro problem, Adding the 'A1:U146'=&lt;br&gt;
, 'basic' gives me the error above.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks again&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Alex&lt;br&gt;
&lt;br&gt;
I don't know how to deal with this through Matlab, but I doubt that&lt;br&gt;
you can over-ride macros with an external program like Matlab.&lt;br&gt;
Obviously you have access to Excel.  It would be fast and easy to&lt;br&gt;
disable all macros in Excel.  Just set the macro security level to&lt;br&gt;
High, then restart Excel.  Then you can run your program, and reset&lt;br&gt;
the Excel macro security when you are done.  Is this a possibility?&lt;br&gt;
&lt;br&gt;
Andy</description>
    </item>
    <item>
      <pubDate>Tue, 06 Jan 2009 15:30:05 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620090</link>
      <author>Alex Thiele</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
Thanks for the message. Unfortunately even if I set the macro security level to 'very high', these macros still run!&lt;br&gt;
&lt;br&gt;
Regards,&lt;br&gt;
&lt;br&gt;
Alex</description>
    </item>
    <item>
      <pubDate>Wed, 07 Jan 2009 08:25:05 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620229</link>
      <author>Aslak Grinsted</author>
      <description>&quot;Alex Thiele&quot; &amp;lt;bert1234@yahoo.com&amp;gt; wrote in message &amp;lt;gjvtdt$rmv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for the message. Unfortunately even if I set the macro security level to 'very high', these macros still run!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Regards,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Alex&lt;br&gt;
&lt;br&gt;
Hi&lt;br&gt;
&lt;br&gt;
I dont think it is possible then using the built-in xlsread function. But you can probably do it interfacing the activex component directly.&lt;br&gt;
&lt;br&gt;
Try looking at this:&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22365&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/22365&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
You have to look through the documentation for the excel.application object to find out how you can load and disable macros.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb978780.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/bb978780.aspx&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Aslak</description>
    </item>
    <item>
      <pubDate>Wed, 07 Jan 2009 08:48:03 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620233</link>
      <author>Aslak Grinsted</author>
      <description>Regarding disabling macros when reading an excel file.&lt;br&gt;
&lt;br&gt;
&amp;gt; I dont think it is possible then using the built-in xlsread function. But you can probably do it interfacing the activex component directly.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Try looking at this:&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22365&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/22365&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You have to look through the documentation for the excel.application object to find out how you can load and disable macros.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb978780.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/bb978780.aspx&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Aslak&lt;br&gt;
&lt;br&gt;
Here are some more clues.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.eggheadcafe.com/software/aspnet/30310387/-deactivating-auto-mac.aspx&quot;&gt;http://www.eggheadcafe.com/software/aspnet/30310387/-deactivating-auto-mac.aspx&lt;/a&gt;</description>
    </item>
    <item>
      <pubDate>Wed, 07 Jan 2009 11:29:02 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620253</link>
      <author>Alex Thiele</author>
      <description>Thank you for your message.&lt;br&gt;
&lt;br&gt;
I tried making my own version of xlsread.&lt;br&gt;
&lt;br&gt;
I tried lots of different variations of 'EnableEvents=False' before and after the open command (line 250 in xlsread)&lt;br&gt;
&lt;br&gt;
Excel.Application.EnableEvents(false)&lt;br&gt;
Excel.workbook.Application.EnableEvents(false)&lt;br&gt;
Excel.EnableEvents(false)&lt;br&gt;
&lt;br&gt;
etc, but the macro still appeared!&lt;br&gt;
&lt;br&gt;
Thanks again,&lt;br&gt;
&lt;br&gt;
Alex</description>
    </item>
    <item>
      <pubDate>Thu, 08 Jan 2009 15:58:32 -0500</pubDate>
      <title>Re: Disable Excel Macro</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241932#620492</link>
      <author>fhirsch@entrerock.com</author>
      <description>Perhaps you could go check out the Application.automationSecurity&lt;br&gt;
object in Excel 2007&lt;br&gt;
This example is from VBA help in Excel 2007&lt;br&gt;
&lt;br&gt;
This example captures the current automation security setting, changes&lt;br&gt;
the setting to disable macros, displays the Open dialog box, and after&lt;br&gt;
opening the selected document, sets the automation security back to&lt;br&gt;
its original setting.&lt;br&gt;
&lt;br&gt;
Microsoft Visual Basic for Applications&lt;br&gt;
Sub Security()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Dim secAutomation As MsoAutomationSecurity&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;secAutomation = Application.AutomationSecurity&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Application.AutomationSecurity = msoAutomationSecurityForceDisable&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Application.FileDialog(msoFileDialogOpen).Show&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Application.AutomationSecurity = secAutomation&lt;br&gt;
&lt;br&gt;
End Sub</description>
    </item>
  </channel>
</rss>

