{"id":299,"date":"2021-01-10T15:43:28","date_gmt":"2021-01-10T15:43:28","guid":{"rendered":"http:\/\/www.haroldstreet.org.uk\/osgb\/?page_id=299"},"modified":"2021-01-12T12:47:32","modified_gmt":"2021-01-12T12:47:32","slug":"migrating-vba-office-code-to-mac","status":"publish","type":"page","link":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/","title":{"rendered":"Migrating VBA\/Office code to MAC"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\"><strong><u>Background<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is an outline of some of the challenges encountered in porting an Excel\/VBA application, OSGB, &nbsp;from Windows to MAC.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The OSGB application imports gpx (cartography) files into Excel, compresses GPX data, exports gpx files for plotting on map applications, and exports kml files for plotting with Google Earth.&nbsp; It performs conversions and calculations on the British Ordnance Survey mapping grid, and also accesses the Streetmap web page to translate UK postcodes to position coordinates. &nbsp;&nbsp;&nbsp;See <a href=\"http:\/\/www.haroldstreet.org.uk\/osgb\/\">http:\/\/www.haroldstreet.org.uk\/osgb\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is issued as an addin which includes the main routines, and an Excel workbook which performs installation of the addin and gives examples of the functions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Parts of it were originally developed in Visual Basic in the 1990s, were further developed under Excel 2003, then enhanced to use the ribbon interface of Excel 2007+ and Excel 2016 on Windows.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">More recently, thanks to excellent cooperation with Ian Baines, it has been enhanced to operate on MAC with Excel 2016 and 2019.&nbsp; I would not like to minimise the challenge of this task or Ian\u2019s dedication in debugging code remotely.&nbsp; More than 90 versions of the code or testbed programs were tried over a period of six months before we were satisfied that we had robust code.&nbsp; Trial and error were sometimes our only tools due to major omissions, errors and half-truths in the documentation! &nbsp;&nbsp;&nbsp;My son has helped with testing on Office 365.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This page outlines some of the major challenges of this enhancement.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Which Version?<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The vba construct <em>Application.Version<\/em> gives the version number.&nbsp; Versions tried were:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MAC Office 2016.&nbsp; As originally installed it gave version 15.32 which needed a (free) upgrade to take it to 16.16.&nbsp; Without that, very basic functions such as <em>Application.UserLibraryPath<\/em> failed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MAC Office 2019 version 16.43 which seems to be stable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MAC Office 365 version 16.41.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>What Worked?<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The code for creating the ribbon interface was fine, as was all the code to manipulate and convert coordinates, compute distances, calculate magnetic variation, to create user forms, the undo functionality, to perform both recursive and iterative routines and to manipulate cells.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All this worked without change which was both surprising and impressive!&nbsp; However, joy turned to despair once file access was attempted.&nbsp;&nbsp; Issues needing care or a major rewrite included:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Differences in the format of filenames.&nbsp;<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Path separators for MAC are \/ rather than \\ of Windows.&nbsp; Very easily accommodated.&nbsp; Use Application.PathSeparator.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Spaces in filenames<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Spaces in filenames are an issue for shell commands under both Windows and MAC and in applescript functions.&nbsp; Either \u2018wrap\u2019 them in chr(34) characters or, in the case of MAC, prefix the spaces with the backslash character \\.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>How to install the add-in?<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">With XP + Excel 2003 \u2013 copy it to <em>Application.UserLibraryPath<\/em>.&nbsp; No further action is needed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Excel 2007 or later, whether Windows 7, Windows 10 or MAC you need to also mark it as \u2018installed\u2019 in registry like this:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>Dim ai As Excel.AddIn<\/em><\/p><p><em>Dim DestFile as string<\/em><\/p><p><em>DestFile= Application.UserLibraryPath &amp; Application.PathSeparator &amp;&nbsp; \u201cosgb.xlam\u201d<\/em><\/p><p><em>Set ai = AddIns.Add(Filename:=DestFile)<\/em><\/p><p><em>ai.Installed = True<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Note that with MAC + Excel 2016 version 15.32&nbsp; <em>Application.UserLibraryPath<\/em> gives a compilation error.&nbsp;&nbsp;&nbsp; Upgrade Excel to 16.16.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>GetOpenFileName<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This does not support the FileFilter parameter so file type checking will need to be done after the user has selected a file.&nbsp; Apart from that, it appears to work provided you meet sandbox requirements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>GetSaveAsFileName.<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>S<\/strong>imilarly, this does not support FileFilter. &nbsp;&nbsp;However, far more seriously, we found GetSaveAsFileName to be quite unstable and caused Excel to freeze and lock-up.&nbsp;&nbsp; It would seem to work first time but \u2018poison\u2019 Excel in the process and freeze on subsequent calls.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Choosing Files:&nbsp;&nbsp; Applescript Solution<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The solution to stability in choosing files was to drop down into applescript.&nbsp; It needed a file in folder:&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;~\/Library\/Application Scripts\/com.microsoft.Excel\/&nbsp; (but note the pesky space in that folder path!)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The applescript construct <em><u>choose file<\/u><\/em> allows a file to be chosen for reading, and <em><u>choose file name<\/u><\/em> to choose one for writing so we simply used an applescript function (event?) for each type of file required.&nbsp;&nbsp; It is typically called like this:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p> <em>fname = AppleScriptTask(&#8220;osgb.applescript&#8221;, &#8220;ChooseGPXread,\u201d\u201d)<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">but you will need to check the response that the right file suffix has been supplied.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Choosing a file in this way seems to avoid all the instability problems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Placing the file in&nbsp;&nbsp;&nbsp; <em>~\/Library\/Application Scripts\/com.microsoft.Excel\/ osgb.applescript<\/em> proved challenging and we found no way of doing this directly from vba.&nbsp; Our solution was to place the applescript file initially in a benign location (we used <em>Application.ThisWorkbook.Path<\/em>) then ask the user to invoke the file manually from Finder, whereupon the copy command at the start of the script did the job for us.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The contents of the applescript file is environment dependent as it includes the username and its own location so needs creating dynamically during installation.&nbsp; The username can be extracted by splitting&nbsp; <em>Application.UserLibraryPath<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you copy\/paste this please beware of any line splitting by Word, particularly the shell copy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The full file, osgb.applescript is:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>do shell script &#8220;mkdir -p \u2018\/Users\/&lt;username&gt;\/Library\/Application Scripts\/com.microsoft.Excel \u2018&#8221;<\/em><\/p><p><em>do shell script &#8220;cp &#8216;&lt;the temporary location&gt;\/ osgb.applescript&#8217; &nbsp;\u2018\/Users\/&lt;username&gt;\/Library\/Application Scripts\/com.microsoft.Excel\/osgb.applescript\u2019'&#8221;<\/em><\/p><p><em>display dialog &#8220;Please save the examples workbook to complete installation.&#8221; buttons {&#8220;ok&#8221;}<\/em><\/p><p><em>return<\/em><\/p><p><em>on Present()<\/em><\/p><p><em>return &#8220;present&#8221;<\/em><\/p><p><em>end Present<\/em><\/p><p><em>on ChooseGPXread()<\/em><\/p><p><em>set theDocument to ((choose file with prompt &#8220;Please select a gpx file&#8221; of type {&#8220;gpx&#8221;}) as string)<\/em><\/p><p><em>return POSIX path of theDocument<\/em><\/p><p><em>end ChooseGPXread<\/em><\/p><p><em>on ChooseGPXwrite()<\/em><\/p><p><em>set theDocument to ((choose file name with prompt &#8220;Please specify a .gpx file for writing&#8221;)&nbsp; as string)<\/em><\/p><p><em>return POSIX path of theDocument<\/em><\/p><p><em>end ChooseGPXwrite<\/em><\/p><p><em>on ChooseKMLwrite()<\/em><\/p><p><em>set theDocument to ((choose file name with prompt &#8220;Please specify a .kml file for writing&#8221;) as string)<\/em><\/p><p><em>return POSIX path of theDocument<\/em><\/p><p><em>end ChooseKMLwrite<\/em><\/p><p><em>on ChoosePMwrite()<\/em><\/p><p><em>set theDocument to ((choose file name with prompt &#8220;Please specify a postmortem file (.pm) for writing&#8221;) as string)<\/em><\/p><p><em>return POSIX path of theDocument<\/em><\/p><p><em>end ChoosePMwrite<\/em><\/p><p><em>on osgbopen(f)<\/em><\/p><p><em>tell application &#8220;Finder&#8221; to open f as POSIX file<\/em><\/p><p><em>return 1<\/em><\/p><p><em>end osgbopen<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">The routine <em>present<\/em> allows you to check whether the applescript file needs to be supplied.&nbsp; Eg:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Function AppleScriptNeeded() As Boolean<\/p><p>#If Mac Then<\/p><p>&nbsp;&nbsp;&nbsp; On Error GoTo errh<\/p><p>&nbsp;&nbsp;&nbsp; AppleScriptNeeded = False<\/p><p>&nbsp;&nbsp;&nbsp; If (AppleScriptTask(&#8220;osgb.applescript&#8221;, &#8220;Present&#8221;, &#8220;&#8221;) &lt;&gt; &#8220;present&#8221;) Then<\/p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppleScriptNeeded = True<\/p><p>&nbsp; &nbsp;&nbsp;End if<\/p><p>&nbsp;&nbsp;&nbsp; Exit Function<\/p><p>errh:<\/p><p>&nbsp;&nbsp;&nbsp; AppleScriptNeeded = True<\/p><p>#Else<\/p><p>&nbsp;&nbsp;&nbsp; AppleScriptNeeded = False<\/p><p>#End If<\/p><p>End Function<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">The Office 365 system we tried this on did not have the applescript folder created during office installation, hence the initial mkdir in the applescript file.&nbsp; This did not work initially \u2013 the write functions froze the system, but a month or so later it did work.&nbsp; We believe that an intervening system restart fixed it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Sandbox Implications<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Excel 2016 onwards is run on MAC within a \u2018sandbox\u2019 which requires permissions to be granted for folder and file accesses outside the sandbox.&nbsp;&nbsp; The Excel routine GrantAcesstoMultipleFiles can be used to ask the user for permissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before opening any file, we adopted the strategy of issuing GrantAcesstoMultipleFiles for the folder holding the file and then, if the file exists, for that too. That is in in addition to the special measures which were needed to choose files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We wonder whether there is a chicken and egg situation with GetFileName and GetSaveasFileName.&nbsp; If you do not have permissions to access the folder then how can you read it in order to choose a file?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our solution to choosing, writing to then opening a file (eg a kml file) was:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Choose file with applescript function ChooseKMLWrite.<\/li><li>Check file type.<\/li><li>Grant permissions on folder<\/li><li>Grant permissions on file (If it exists)<\/li><li>Open and write to the file<\/li><li>Grant permissions on the file<\/li><li>Open the file with the system dependent application with the applescript function &nbsp;osgbopen.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Note that these are <em>sufficient<\/em> but perhaps not <em>necessary<\/em> steps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Application.IsSandboxed<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There is a vba function Application.IsSandboxed which sounds to be very useful.&nbsp; Unfortunately, it isn\u2019t!&nbsp;&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"a\"><li>It does not work \u2013 it does not return \u2018true\u2019 with Excel 2019\/365 as one would expect<\/li><li>Even if it did work, it would not be useful \u2013 it needs to be a compile time directive to exclude GrantAcesstoMultipleFiles calls in a non sandboxed environment<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">You might try:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #if MAC_OFFICE_VERSION &gt;=16 then<\/p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GrantAcesstoMultipleFiles \u2026\u2026.<\/p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #end if<\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Reading a URL<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We (ab)use the Streetmap web site to \u2018scrape\u2019 the location of postcodes in GB and this needed a different approach on MAC.&nbsp; See the brilliant execShell() function courtesy of Robert Knight via StackOverflow:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/stackoverflow.com\/questions\/15981960\/how-do-i-issue-an-http-get-from-excel-vba-for-mac\">https:\/\/stackoverflow.com\/questions\/15981960\/how-do-i-issue-an-http-get-from-excel-vba-for-mac<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><u>Open a file<\/u><\/strong> with its native application:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once we have written a gps or a kml file we ask the user whether it should be opened \u2013 typically with a mapping application like MemoryMap, Garmin Basecamp or Google Earth.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With windows we used:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>Reply=shell(\u201cexplorer \u201c &amp; chr(34) &amp; filename &amp; chr(34))<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">On MAC we tried:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><em>Reply=shell(\u201copen \u201c &amp; chr(34) &amp; filename &amp; chr(34))<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">That was fine with Excel 2019 but not Excel 2016.&nbsp; Instead, we had to delve down into the Applescript routine osgbopen.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Reply= AppleScriptTask(&#8220;osgb.applescript&#8221;, &#8220;osgbopen&#8221;, <em>&nbsp;chr(34) &amp; filename &amp; chr(34))<\/em><\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">The chr(34) is necessary in case there are spaces in the filename.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>References<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/www.haroldstreet.org.uk\/osgb\/\">http:\/\/www.haroldstreet.org.uk\/osgb\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.microsoft.com\/en-us\/office\/vba\/api\/overview\/office-mac\">https:\/\/docs.microsoft.com\/en-us\/office\/vba\/api\/overview\/office-mac<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/macadmins.software\/docs\/UserContentIn2016.pdf\">https:\/\/macadmins.software\/docs\/UserContentIn2016.pdf<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/www.rondebruin.nl\/mac\/mac034.htm\">http:\/\/www.rondebruin.nl\/mac\/mac034.htm<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/warwick.ac.uk\/fac\/sci\/systemsbiology\/staff\/dyer\/software\/excelvbafileopen\/\">https:\/\/warwick.ac.uk\/fac\/sci\/systemsbiology\/staff\/dyer\/software\/excelvbafileopen\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/forum.latenightsw.com\/t\/debugging-an-applescript-handler-in-vba\/2705\">https:\/\/forum.latenightsw.com\/t\/debugging-an-applescript-handler-in-vba\/2705<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/youpresent.co.uk\/developing-installers-for-office-mac-2016-application-add-ins\/\">http:\/\/youpresent.co.uk\/developing-installers-for-office-mac-2016-application-add-ins\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"http:\/\/stackoverflow.com\/questions\/6136798\/vba-shell-function-in-office-2011-for-mac\">http:\/\/stackoverflow.com\/questions\/6136798\/vba-shell-function-in-office-2011-for-mac<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/stackoverflow.com\/questions\/15981960\/how-do-i-issue-an-http-get-from-excel-vba-for-mac\">https:\/\/stackoverflow.com\/questions\/15981960\/how-do-i-issue-an-http-get-from-excel-vba-for-mac<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Thanks<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks to Phil Newby for his generosity in hosting this content, to Ian Baines for his assistance in debugging on the MAC and my son for testing it with Office 365.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong><u>Contact<\/u><\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You can contact me with my first name dot second name on my UK Hotmail account to discuss the above.&nbsp; No spam please!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Phil Brady 15 Dec 2020.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Background This is an outline of some of the challenges encountered in porting an Excel\/VBA application, OSGB, &nbsp;from Windows to MAC. The OSGB application imports gpx (cartography) files into Excel, compresses GPX data, exports gpx files for plotting on map applications, and exports kml files for plotting with Google Earth.&nbsp; It performs conversions and calculations [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-299","page","type-page","status-publish","hentry"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Background This is an outline of some of the challenges encountered in porting an Excel\/VBA application, OSGB, from Windows to MAC. The OSGB application imports gpx (cartography) files into Excel, compresses GPX data, exports gpx files for plotting on map applications, and exports kml files for plotting with Google Earth. It performs conversions and calculations\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/migrating-vba-office-code-to-mac\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/migrating-vba-office-code-to-mac\\\/#listItem\",\"name\":\"Migrating VBA\\\/Office code to MAC\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/migrating-vba-office-code-to-mac\\\/#listItem\",\"position\":2,\"name\":\"Migrating VBA\\\/Office code to MAC\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb#listItem\",\"name\":\"Home\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/#person\",\"name\":\"Philip Brady\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/migrating-vba-office-code-to-mac\\\/#webpage\",\"url\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/migrating-vba-office-code-to-mac\\\/\",\"name\":\"Migrating VBA\\\/Office code to MAC | Ordnance Survey FAQ and Excel Mapping Routines\",\"description\":\"Background This is an outline of some of the challenges encountered in porting an Excel\\\/VBA application, OSGB, from Windows to MAC. The OSGB application imports gpx (cartography) files into Excel, compresses GPX data, exports gpx files for plotting on map applications, and exports kml files for plotting with Google Earth. It performs conversions and calculations\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/migrating-vba-office-code-to-mac\\\/#breadcrumblist\"},\"datePublished\":\"2021-01-10T15:43:28+00:00\",\"dateModified\":\"2021-01-12T12:47:32+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/#website\",\"url\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/\",\"name\":\"Ordnance Survey FAQ and Excel Mapping Routines\",\"description\":\"Phil Brady \\u00a9 2020\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.haroldstreet.org.uk\\\/osgb\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Migrating VBA\/Office code to MAC | Ordnance Survey FAQ and Excel Mapping Routines","description":"Background This is an outline of some of the challenges encountered in porting an Excel\/VBA application, OSGB, from Windows to MAC. The OSGB application imports gpx (cartography) files into Excel, compresses GPX data, exports gpx files for plotting on map applications, and exports kml files for plotting with Google Earth. It performs conversions and calculations","canonical_url":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.haroldstreet.org.uk\/osgb#listItem","position":1,"name":"Home","item":"https:\/\/www.haroldstreet.org.uk\/osgb","nextItem":{"@type":"ListItem","@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/#listItem","name":"Migrating VBA\/Office code to MAC"}},{"@type":"ListItem","@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/#listItem","position":2,"name":"Migrating VBA\/Office code to MAC","previousItem":{"@type":"ListItem","@id":"https:\/\/www.haroldstreet.org.uk\/osgb#listItem","name":"Home"}}]},{"@type":"Person","@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/#person","name":"Philip Brady"},{"@type":"WebPage","@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/#webpage","url":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/","name":"Migrating VBA\/Office code to MAC | Ordnance Survey FAQ and Excel Mapping Routines","description":"Background This is an outline of some of the challenges encountered in porting an Excel\/VBA application, OSGB, from Windows to MAC. The OSGB application imports gpx (cartography) files into Excel, compresses GPX data, exports gpx files for plotting on map applications, and exports kml files for plotting with Google Earth. It performs conversions and calculations","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/#website"},"breadcrumb":{"@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/migrating-vba-office-code-to-mac\/#breadcrumblist"},"datePublished":"2021-01-10T15:43:28+00:00","dateModified":"2021-01-12T12:47:32+00:00"},{"@type":"WebSite","@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/#website","url":"https:\/\/www.haroldstreet.org.uk\/osgb\/","name":"Ordnance Survey FAQ and Excel Mapping Routines","description":"Phil Brady \u00a9 2020","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.haroldstreet.org.uk\/osgb\/#person"}}]}},"aioseo_meta_data":{"post_id":"299","title":null,"description":null,"keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"","defaultPostTypeGraph":""},"schema_type":"none","schema_type_options":"{\"webPage\":{\"webPageType\":\"WebPage\"},\"article\":{\"articleType\":\"BlogPosting\"},\"book\":[],\"course\":[],\"event\":[],\"jobPosting\":[],\"music\":[],\"person\":[],\"product\":[],\"recipe\":[],\"restaurant\":[],\"service\":[],\"software\":[],\"video\":[]}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":{"businessInfo":{"name":"","urls":{"website":"","aboutPage":"","contactPage":""},"address":{"line1":"","line2":"","zip":"","city":"","state":"","country":""},"contact":{"email":"","phone":"","fax":""},"ids":{"vatID":"","taxID":"","chamberID":""},"payment":{"priceIndication":"","currenciesAccepted":"","methodsAccepted":""},"areaServed":""},"openingHours":{"show":false,"closedLabel":"","open24h":false,"open24hLabel":"","open247":false,"use24hFormat":false,"twoSets":false,"timezone":"","hours":[]}},"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-01-10 15:32:28","updated":"2025-06-04 03:29:34","seo_analyzer_scan_date":null},"_links":{"self":[{"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/pages\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/comments?post=299"}],"version-history":[{"count":12,"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/pages\/299\/revisions"}],"predecessor-version":[{"id":329,"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/pages\/299\/revisions\/329"}],"wp:attachment":[{"href":"https:\/\/www.haroldstreet.org.uk\/osgb\/wp-json\/wp\/v2\/media?parent=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}