<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Plymouth Design Group &#187; Microsoft Excel</title>
	<atom:link href="http://plymdesign.com/category/microsoft-excel/feed/" rel="self" type="application/rss+xml" />
	<link>http://plymdesign.com</link>
	<description></description>
	<lastBuildDate>Fri, 18 Jun 2010 21:44:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Macros For Macintosh Excel 2008 using XLM</title>
		<link>http://plymdesign.com/microsoft-excel/macros-for-macintosh-excel-2008-using-xlm/</link>
		<comments>http://plymdesign.com/microsoft-excel/macros-for-macintosh-excel-2008-using-xlm/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 20:56:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft Excel]]></category>

		<guid isPermaLink="false">http://plymdesign.com/?p=111</guid>
		<description><![CDATA[Yes you can write macro code for Excel 2008 on the Mac using XLM macros &#8211; also known as Excel 4.0 macros


A little known feature of Excel on both Windows and Mac is XLM macros, also called Excel 4.0 macros, an old technology that dates back to 1992, before most of you even owned a [...]]]></description>
			<content:encoded><![CDATA[<h2><em>Yes you can write macro code for Excel 2008 on the Mac using XLM macros &#8211; also known as Excel 4.0 macros</em></h2>
<p><em><br />
</em></p>
<p>A little known feature of Excel on both Windows and Mac is XLM macros, also called Excel 4.0 macros, an old technology that dates back to 1992, before most of you even owned a computer!  Another macro technology, VBA (Visual Basic for Applications) followed a year later, but XLM macros still work in all recent versions of Excel.</p>
<p>Why should you care?  Because you can build a cross-platform compatible workbook using XLM macros.  That&#8217;s right &#8211; you can open the same workbook under Excel 2004 for Mac, Excel 2008 for Mac, Excel 2003 for Windows or Excel 2007 for Windows, and the XLM macros will run the same in all these environments.  Go ahead &#8211; try that with VBA!  You&#8217;ll find that VBA doesn&#8217;t work at all under Excel 2008 for Mac, because Microsoft <a href="http://www.schwieb.com/blog/2006/08/08/saying-goodbye-to-visual-basic/">decided</a> to remove it.  They are pushing users toward AppleScript as an alternative scripting technology, but AppleScript cannot respond to events such as clicking a command button.  VBA support will <a href="http://www.macworld.com/article/133393/2008/05/vba.html">return</a> in Excel 2011 for Mac, but for now, XLM macros are the only way to achieve cross-platform compatibility.</p>
<h3>What you can do</h3>
<p>XLM contains hundreds of functions and closely maps the capabilities of VBA.  There are a few things that XLM can do which VBA cannot.  Since this technology has not been updated in a long time, you&#8217;ll reach occasional stumbling points when trying to implement options that are found only in more recent releases of Excel.  It is possible to have XLM macros in the same workbook with VBA code.</p>
<h3>Documentation</h3>
<p>Microsoft provides documentation for XLM functions in a series of Word docs that can be downloaded in a Mac .sit archive from the <a title="Excel XLM function reference in .SIT format" href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=00d31943-3ad1-4df1-9f93-c19c7e84f01c">Microsoft Download Center</a>.  If you are a Windows user, you&#8217;ll probably find<a title="Excel XLM function reference" href="http://plymdesign.com/files/excel_xlm_reference.zip"> our .zip file</a> of the same docs to be more convenient.</p>
<h3>How XLM works</h3>
<p>First, you will need to add a macro sheet.  To do this, right click on a worksheet tab and select Insert, then choose Excel 4.0 Macro Sheet.   The keyboard shortcut is Ctrl-F11 on Windows.  You will see a new worksheet added called &#8220;Macro1&#8243; and it will look like a typical worksheet except the column widths are wider by default.  Macro commands are entered into cells and all cell entries begin with an equals sign.   A typical macro begins with a label like &#8220;Test1&#8243; and ends with the statement &#8220;=RETURN()&#8221;.</p>
<h3>A Simple Example</h3>
<p>Here is a simple example.  Enter the following lines in cells A1 through A3 on your Macro1 worksheet.</p>
<table style="border-collapse: collapse; width: 108pt;" border="0" cellspacing="0" cellpadding="0" width="144">
<col style="width: 108pt;" width="144"></col>
<tbody>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt; width: 108pt;" width="144" height="17">Test1</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=ALERT(&#8221;Hello World&#8221;)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=RETURN()</td>
</tr>
</tbody>
</table>
<p>Set a range name for cell A1 (Insert &gt;Name&gt;Define).  The label &#8220;Test1&#8243; in cell A1 is actually irrelevant; what matters is the range name you assign to it.  We recommend using the same name (&#8221;Test1&#8243; in this case).  Select the radio button for the Command option in the Macro selector in the bottom right corner of the dialog.    Click Add then OK.  Now you can test your macro by running it.  Just click on Tools&gt; Macros&gt;Macro and run Test1.  You should see the alert box containing the text &#8220;Hello World.&#8221;</p>
<h3>More About Dialogs</h3>
<p>Right click on a worksheet tab again, but this time select Insert then MS Excel 5.0 Dialog.   Up pops a worksheet tab called Dialog1.  You can use your Forms toolbar to add text, buttons, spinners and more.  The process  is very similar to VBA forms.</p>
<h3>Another Example</h3>
<p>You can download an <a href="http://plymdesign.com/files/Employees.xls">example</a> of a workbook with XLM macros to maintain a simple list of employees.  Each employee has a name and a position.  When you click the &#8220;Add Employee&#8221; button, a dialog will appear where you can enter the name and position of a new employee.</p>
<p>Below you can see the macro code, which demonstrate some conditionals (IF) and looping (WHILE):</p>
<table style="border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">ShowAddEmployeeForm</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=SHOW.DIALOG(&#8221;Dialog1&#8243;)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=RETURN()</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17"></td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">AddEmployeeOK</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=WORKBOOK.SELECT(&#8221;Dialog1&#8243;)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=SET.NAME(&#8221;EmployeeName&#8221;,GET.OBJECT(12,&#8221;Edit Box 5&#8243;))</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=SET.NAME(&#8221;EmployeePosition&#8221;,GET.OBJECT(12,&#8221;Edit Box 7&#8243;))</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=WORKBOOK.SELECT(&#8221;Employees&#8221;)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=IF(EmployeeName=&#8221;")</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=  ALERT(&#8221;The employee name was not entered.&#8221;)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=  RETURN()</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=END.IF()</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=SET.NAME(&#8221;CurrentReference&#8221;,Employees!A2)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=WHILE(AND(DEREF(CurrentReference)&lt;&gt;&#8221;",DEREF(CurrentReference)&lt;&gt;EmployeeName))</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=  SET.NAME(&#8221;CurrentReference&#8221;,ABSREF(&#8221;R[1]C&#8221;,CurrentReference))</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=NEXT()</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=IF(DEREF(CurrentReference)=EmployeeName)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=  ALERT(&#8221;A record with this employee name already exists.&#8221;)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=  RETURN()</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=END.IF()</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=FORMULA(EmployeeName,CurrentReference)</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=FORMULA(EmployeePosition,ABSREF(&#8221;RC[1]&#8220;,CurrentReference))</td>
</tr>
<tr style="height: 12.75pt;" height="17">
<td style="height: 12.75pt;" height="17">=RETURN()</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://plymdesign.com/microsoft-excel/macros-for-macintosh-excel-2008-using-xlm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project: Mail Merge for Macintosh Excel 2004</title>
		<link>http://plymdesign.com/projects/project-mail-merge-for-macintosh-excel-2004/</link>
		<comments>http://plymdesign.com/projects/project-mail-merge-for-macintosh-excel-2004/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 16:33:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Microsoft Excel]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://plymdesign.com/wp/?p=41</guid>
		<description><![CDATA[Fairhaven Health asked us to streamline the daily processing of orders by automating tasks in their Excel spreadsheet.
Their requests were a straightforward project for Windows Excel, but a much more complex solution was required to work in their Macintosh Excel 2004 environment.
Their existing procedure involved several steps:
(1) importing an order file from each of several [...]]]></description>
			<content:encoded><![CDATA[<p>Fairhaven Health asked us to streamline the daily processing of orders by automating tasks in their Excel spreadsheet.<br />
Their requests were a straightforward project for Windows Excel, but a much more complex solution was required to work in their Macintosh Excel 2004 environment.</p>
<p>Their existing procedure involved several steps:</p>
<p>(1) importing an order file from each of several sources into an Excel 2004 spreadsheet<br />
(2) sorting to find duplicate addresses<br />
(3) generating a new worksheet with orders combined from all sources<br />
(4) constructing new columns such as the total cost and a barcode<br />
(5) saving the resulting spreadsheet as a source for mail merges in Word 2004 to generate invoices and labels</p>
<p>The procedure was partially automated &#8212; they already had a template spreadsheet with formulas for the new columns, along with some VBA macros.  Our task was to refine the process and make it more robust.</p>
<p>We first developed a VBA macro to automate the entire process.  Under the new scheme, we store the order<br />
files with fixed names, in a folder based on the date.  We then run this new macro which does all the necessary importing, sorting, combining and saving.</p>
<p>Here are some specific changes and improvements that we implemented:</p>
<p>(1) Data Validation: The existing spreadsheet imported zip codes as numbers, with the result that leading zeroes were<br />
dropped.  The new macro explicitly imports the zip code column as text.</p>
<p>(2) Code Optimization: The existing spreadsheet had formulas to build the new columns, presuming a certain maximum<br />
number of rows.  The new macro builds the needed columns for just as many rows as are actually present.</p>
<p>(3) Error Trapping: Some orders are paid with PayPal and have authorization but no transaction ID.  If the client didn&#8217;t catch this omission, he doesn&#8217;t get paid for that order.  The new macro counts the PayPal authorizations and transaction IDs, with the transaction ID count highlighted in red if it doesn&#8217;t match the authorization count.</p>
<p>(4) Error Trapping: For international orders, the country name is found by looking up the country code in a table. We added an error trap to the macro in case the country code is not found.</p>
<p>(5) The existing procedure involved saving the worksheet as tab-delimited text to generate a file to be uploaded to mark orders as shipped.  This worked fine except that the last line was missing the end-of-line character (CR).  He had to edit the file manually and insert a CR at the end, or else the last line wouldn&#8217;t be processed.  The new macro solves this problem by building the file directly with VBA file I/O.</p>
]]></content:encoded>
			<wfw:commentRss>http://plymdesign.com/projects/project-mail-merge-for-macintosh-excel-2004/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
