Environmental Variables
Windows 7 - Control Panel, System, Advanced System Settings, Advanced Tab, Environment Variables.
These must be added to the User Variables and not the System Variables.
VSTO_EVENTLOGDISABLED - 0
You can use the event viewer to see messages captured by the VSTO runtime.
Applies to document level and application level projects in 2007 and 2010
0 - enables event logging (default)
1 - disables event logging
SS
VSTO_LOGALERTS - 1
This environment variable allows you to write the error messages to a log file.
For an add-in this log file (manifestname.manifest.log) is created in the folder that contains the deployment or application manifest
For a document-level solution this log file (documentname.extension.log, ExcelWorkbook1.xlsx.log) is created in the folder that contains the workbook or document.
This is only relevant if the add-in has full trust
1 - populate log
0 - suppress log (default)
If that fails then the log file is created in the local %TEMP% folder
SS
VSTO_SUPPRESSDISPLAYALERTS - 0
This environment variable allows you to display each error message in a message box.
This is only relevant if the add-in has full trust
0 - display alerts
1 - suppress alerts (default)
This displays the "Microsoft Office Application Add-in" dialog box when the application starts
SS
Event Viewer
Starting in Visual Studio 2008 SP1 error messages that are captured by the runtime will appear in the event viewer.
Control Panel > Administrative Tools > Event Viewer - Application
Event Source = VSTO 4.0 | VSTO 3.0
Event Source = .NET Runtime
SS
Sub CreateEnvironmentVariable()
Dim wshShell As Object
Dim wshUserEnv As Object
Set wshShell = CreateObject("WScript.Shell")
Set wshUserEnv = wshShell.Environment("USER")
' Set the environment variable
wshUserEnv("VSTO_SUPPRESSDISPLAYALERTS") = 0
MsgBox "Environment Variable VSTO_SUPPRESSDISPLAYALERTS was created", vbOKOnly + vbInformation, "Success"
Set wshUserEnv = Nothing
Set wshShell = Nothing
End Sub
Sub RemoveEnvironmentVariable()
Dim wshShell As Object
Dim wshUserEnv As Object
Set wshShell = CreateObject("WScript.Shell")
Set wshUserEnv = wshShell.Environment("USER")
On Error Resume Next
wshUserEnv.Remove ("VSTO_SUPPRESSDISPLAYALERTS")
If Err.Number = 0 Then
MsgBox "Environment Variable VSTO_SUPPRESSDISPLAYALERTS was removed", vbOKOnly + vbInformation, "Success"
Else
MsgBox "Environment Variable VSTO_SUPPRESSDISPLAYALERTS doesn't exist in the system", vbOKOnly + vbCritical, "Error"
End If
Set wshUserEnv = Nothing
Set wshShell = Nothing
End Sub ()
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext