You can use runtime logging to debug your add-in's manifest as well as several installation errors. This feature can help you identify and fix issues with your manifest that are not detected by XSD schema validation, such as a mismatch between resource IDs. Runtime logging is particularly useful for debugging add-ins that implement add-in commands and Excel custom functions.
- External data in Excel 2016 for Mac. We examined how we could improve external data for Excel 2016 for Mac and made the following changes: Excel 2016 for Mac comes with a pre-installed and integrated SQL Server ODBC driver, which we worked hand-in-hand with Simba Technologies to provide.
- Run-time error- (80004005) when you set a property of a chart. 5/22/2020; 2 minutes to read; S; C; A; Applies to: Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2010, Microsoft Excel 2007; In this article.
Problems may occur when you automate Microsoft Word or Microsoft Excel if either the Normal.dot template in Word or the Excel.xlb resource file in Excel is corrupted. To test these files, search the local hard disks for all instances of Normal.dot or of Excel.xlb. Note You may find multiple copies of these files. There is one copy of each of. Microsoft Excel is the most popular data manipulation application used by millions of users across the globe. This application can be used by both personal and business-related data storage and display.
The runtime logging feature is currently available for Office 2016 or later on desktop.
Runtime Logging affects performance. Turn it on only when you need to debug issues with your add-in manifest.
Use runtime logging from the command line
Enabling runtime logging from the command line is the fastest way to use this logging tool. These use npx, which is provided by default as part of [email protected]+. If you have an earlier version of npm, try Runtime logging on Windows or Runtime logging on Mac instructions, or install npx.
To enable runtime logging:
To enable runtime logging only for a specific file, use the same command with a filename:
To disable runtime logging:
To display whether runtime logging is enabled:
To display help within the command line for runtime logging:
Runtime logging on Windows
Make sure that you are running Office 2016 desktop build 16.0.7019 or later.
RuntimeLoggingregistry key under
Developerkey (folder) does not already exist under
HKEY_CURRENT_USERSOFTWAREMicrosoftOffice16.0WEF, complete the following steps to create it.
- Right-click the WEF key (folder) and select New > Key.
- Name the new key Developer.
Set the default value of the RuntimeLogging key to the full path of the file where you want the log to be written. For an example, see EnableRuntimeLogging.zip.
The directory in which the log file will be written must already exist, and you must have write permissions to it.
The following image shows what the registry should look like. To turn the feature off, remove the
RuntimeLogging key from the registry.
Runtime logging on Mac
Make sure that you are running Office 2016 desktop build 16.27 (19071500) or later.
Open Terminal and set a runtime logging preference by using the
<bundle id>identifies which the host for which to enable runtime logging.
<file_name>is the name of the text file to which the log will be written.
<bundle id>to one of the following values to enable runtime logging for the corresponding application:
The following example enables runtime logging for Word and then opens the log file:
You'll need to restart Office after running the
defaults command to enable runtime logging.
To turn off runtime logging, use the
defaults delete command:
The following example will turn off runtime logging for Word:
Use runtime logging to troubleshoot issues with your manifest
To use runtime logging to troubleshoot issues loading an add-in:
Sideload your add-in for testing.
We recommend that you sideload only the add-in that you are testing to minimize the number of messages in the log file.
If nothing happens and you don't see your add-in (and it's not appearing in the add-ins dialog box), open the log file.
Search the log file for your add-in ID, which you define in your manifest. In the log file, this ID is labeled
In the following example, the log file identifies a control that points to a resource file that doesn't exist. For this example, the fix would be to correct the typo in the manifest or to add the missing resource.
Known issues with runtime logging
You might see messages in the log file that are confusing or that are classified incorrectly. For example:
Medium Current host not in add-in's host listfollowed by
Unexpected Parsed manifest targeting different hostis incorrectly classified as an error.
If you see the message
Unexpected Add-in is missing required manifest fields DisplayNameand it doesn't contain a SolutionId, the error is most likely not related to the add-in you are debugging.
Monitorablemessages are expected errors from a system point of view. Sometimes they indicate an issue with your manifest, such as a misspelled element that was skipped but didn't cause the manifest to fail.
AppleScriptTask in Mac Office 2016 or higher
In Mac Office there are many problems with the built-in VBA commands. VBA developers responded by using AppleScript in many situations to work around the problems. They also used AppleScript to do things that are not possible with VBA code; for example to email using VBA code.
In Office 2016 and higher, we need to use a new method and a new approach explained below.
Example for Excel 2011
In Office 2011 we use the built-in MacScript function to run a script that we build up as a string in the VBA code. See the code example below.
See the code example below.
Copy the test macro and the function below into a normal module of your workbook. Change the file path and name in the macro TestMacro to point to a file on your Mac to test.
When you run the macro named TestMacro it will test if the file :
exists on your Mac and display a msgbox showing True or False
Note: You can also use : FileName = '/Users/RDB/Desktop/MacTestFile.xlsm'
Note: You can also use : FileName = '/Users/RDB/Desktop/MacTestFile.xlsm'
Excel 2016 or higher for the Mac
If you test the code that is working correctly in Excel 2011, in Excel 2016 and higher it gives a run-time error 5; but if you test the script string that the VBA code created in the Script Editor, the script works correctly.
What’s the problem here?
The legacy 'MacScript' VB Command is severely limited by Apple’s sandbox requirements: it will not work correctly in most situations in Office 2016 and higher.
Excel Runtime Error Excel 2016 For Mac Free
Instead, Microsoft added a new VB command 'AppleScriptTask' that accesses and runs an AppleScript file located outside the sandboxed app. This new approach is not as convenient: with the MacScript function you could have the script in the file itself, while with the AppleScriptTask method you need to distribute an extra file containing the script, and it must be placed in the specified location on the user’s system to have permission to run. This requires some user interaction the first time.
1) Test the AppleScript in the Script Editor ?
First we open the Script Editor on your Mac.
- Click on the Spotlight icon in the top right corner of your Mac.
- Enter 'Script Editor' to find and open this program.
- Click the New Document button, and we are ready to start.
Tip: Right click on the Script Editor icon in the dock and choose Options>Keep in Dock so it is easy the next time to open it when you need it.
The script you want the VBA code to run looks like this now in the script editor:
tell application 'System Events' to return (exists disk item 'Macintosh HD:Users:RDB:Desktop:MacTestFile.xlsm') and class of disk item 'Macintosh HD:Users:RDB:Desktop:MacTestFile.xlsm' = file
Excel Runtime 2016
- Paste that inside the editor
- Press the Run button
- Observe the Result area at the bottom
- You see the result (True or False)
When your script works correctly in the script editor you have proved that nothing is wrong with the script. Now we go to step 2 to make the script ready for using it with AppleScriptTask.
2) Add the script inside a handler and test it
Replace the script in the Script Editor with the script below.
And for testing only we copy this line at the top
You can use this line instead if you want to use the colon separator
So it looks like this :
- Now save the file as MyFileTest.scpt on your Desktop.
- Use (File>Save)in the Script Editor Menu bar in the top left corner of your Mac window
- The Script Editor must be active to see the Script Editor menu bar.
You see that I placed the code inside a handler named ExistsFile which takes a parameter string of filepath. The name of the handler and parameter string is your choice. You see also in the script line that I replaced both path/file name strings with the variable filepath. This works the same as in the VBA code example for Excel 2011 where we have a string named FileName, which we created in the macro.
Before we try to run the script with AppleScriptTask in VBA we first test the handler inside the Script Editor. The first line in the script is there only for testing.
Press the Run button, and the script test if the file exists on your Mac. The line above the ExistsFile handler provides the filename string to the ExistsFile handler, to enable you to test the script before we take the next step of calling it from VBA.
Before we go to the next step remove the script line above the handler or make it a comment, so the script does not use it. You do this by adding two hyphens before the line so it looks like this:
Click on the Run button and you see that nothing happens, because the handler has no filename string to test. But it test and indents the changes in the script. It is important before you close a file after you make changes to press the Run button.
Close the script file now and you will notice that it has automatically saved your changes.
3) Where to place the script file for using it with AppleScriptTask
Now the script file is ready and tested we must copy it into the correct location. Follow the steps below to copy and paste it into this exact location.
- Open a Finder Window
- Hold the Alt key and click Go in the Finder menu bar
- Click Library
- Click Application Scripts (if it exists; if not create this folder)
- Click com.microsoft.Excel if it exists; if not create this folder (note: Capital letter E)
- Copy MyFileTest.scpt to the com.microsoft.Excel folder.
Note: If you want to use the example in Word you must add/use the com.microsoft.Word folder, each Office app have its own folder. Unfortunately there is no folder for all Office programs.
This are three ways to easily open the com.microsoft.Excel folder manual :
- Add it to your Favorites in Finder by dragging it to it while holding the Alt key down.
- Add it to your Favorites in Finder with the shortcut : cmd Ctrl T
- Drag the folder to the Desktop with the CMD and Alt key down. You now have a link to the folder on your desktop so it is easy to find it and open it in the future.
Note : Adding the folder to your Favorites is my favorite because you see the folder in your open and save dialogs in Excel.
Or use this script one time to create a folder for your Office files and create shortcuts to a few important folders, check out this page : Setup your Mac for Mac Office 2016 or higher
4) Use the script we create in VBA with AppleScriptTask
When you use AppleScriptTask the third argument is a parameter string that you use to give information to the handler. In the example on this page this must be the file path and name of the file that we want to test for.
This is the code line that you use in your VBA code: You see that there are three arguments:
- The script file name
- The name of the handler
- The file name you want to check
RunMyScript = AppleScriptTask('MyFileTest.scpt', 'ExistsFile', '/Users/RDB/Desktop/MacTestFile.xlsm')
So your VBA macro now looks like this :
You can also add code to your workbook that check if the scpt file is in the correct location, copy the function below in the same module as your macro :
You can add this to your macro to stop it when the scpt file is not in the correct location
More than one handler in your script file
You can have more than one handler in the scriptfile; in the screenshot below I have also added a handler to test whether a nominated folder exists on your Mac.
Calling the folder test in VBA looks like this:
RunMyScript = AppleScriptTask('MyFileTest.scpt', 'ExistsFolder', '/Users/RDB/Desktop/YourFolder/')
Excel Runtime Error Excel 2016 For Mac Book
Use string wih more than one parameter in AppleScriptTask
AppleScriptTask can accept only one parameter string, but I found a workaround. See how I use SplitString in the applescript below to use more parameters.
More applescript examples that you can use with AppleScriptTask
Below you find some example scrips that you can copy in a scpt file and run it with VBA. I call the scpt file FileFolder.scpt in the macros below. So copy the scrips in a file FileFolder.scpt and copy it in the correct location on your Mac. You see that the check file and folder scripts from above are also in the scrips below.
And below you find the VBA macros to call the scrips above.
Create SCPT files with VBA code and copy it in the com.microsoft.Excel folder
It is possible to create or update scpt files only with VBA code, but before you can do this you must do some things manual first because Apple not allow you to create the path with VBA code. See point 3 above how to create the path below.
Then copy the MakeSCPTFile.scpt file from the download above inside the com.microsoft.Excel folder.
You must do this only one time and after that you can do everything with VBA code.
Runtime Error 5 Excel Macro
Copy the excel workbook on your desktop and test the code and see if it create a new scpt file inside the com.microsoft.Excel folder for you, you see that you create the script also in the VBA macro. If you change the string in the macro and run the code again it will overwrite the existing scpt file, this way you can update the scpt file.