diff --git a/MainForm.ps1 b/MainForm.ps1 index a6dcfe5..0275e18 100644 --- a/MainForm.ps1 +++ b/MainForm.ps1 @@ -4,11 +4,18 @@ Import-Module Microsoft.Graph.Files # Load Open XML assembly try { - Add-Type -Path "C:\Program Files\Microsoft Office\root\Office16\DocumentFormat.OpenXml.dll" + # Try loading from GAC + Add-Type -AssemblyName "DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" } catch { - [System.Windows.Forms.MessageBox]::Show("Error loading DocumentFormat.OpenXml.dll. Make sure it is installed.") - return + try { + # Try loading from a default path + Add-Type -Path "C:\Program Files\Microsoft Office\root\Office16\DocumentFormat.OpenXml.dll" + } + catch { + [System.Windows.Forms.MessageBox]::Show("Error loading DocumentFormat.OpenXml.dll. Make sure it is installed and the path is correct.") + return + } } # Import our components