T
Tom_Joseph2
Guest
Hello,
I am trying to open Outlook from VB.NET code through a Process object.
Dim PSI As New ProcessStartInfo
PSI.FileName = IO.Path.Combine(GetOutlookPath(), My.Settings.OutlookAppExe) ' "/e ""C:\Program Files\Microsoft Office\Office16\Outlook.exe""" ' GetOutlookPath() & My.Settings.OutlookAppExe
'PSI.Arguments = “/importprf \\comp.us\syscol\comp.us\Software\Outlook2010\comp.prf” ' My.Settings.OutlookAppArgs
Private Function GetOutlookPath() As String
Dim Val As String = ""
If My.Settings.OutlookAppPath = "" Then
Try
Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey(My.Settings.OutlookRegPath)
Val = Key.GetValue("Path")
Val = Val.Replace(";", "")
If Val.LastIndexOf("\") <> Val.Length - 1 Then
Val = Val & "\"
End If
Catch ex As Exception
Log.Add("Unable to get registry value for Outlook: " & ex.Message)
Throw New Exception("Unable to get registry value for Outlook: " & ex.Message)
End Try
Else
Val = My.Settings.OutlookAppPath
End If
Log.Add("GetOutlookPath: " & Val)
Return Val
End Function
I tried replacing the values of Settins variables with actual content to try, but nothing works. Can anyone please help me know how do I set the path values and make it work on all Win OS. This code was working in Win 7, but with Win 10 it's giving a hard time. The arguments passed in Process also gives a hard time.
Thanks
Continue reading...
I am trying to open Outlook from VB.NET code through a Process object.
Dim PSI As New ProcessStartInfo
PSI.FileName = IO.Path.Combine(GetOutlookPath(), My.Settings.OutlookAppExe) ' "/e ""C:\Program Files\Microsoft Office\Office16\Outlook.exe""" ' GetOutlookPath() & My.Settings.OutlookAppExe
'PSI.Arguments = “/importprf \\comp.us\syscol\comp.us\Software\Outlook2010\comp.prf” ' My.Settings.OutlookAppArgs
Private Function GetOutlookPath() As String
Dim Val As String = ""
If My.Settings.OutlookAppPath = "" Then
Try
Dim Key As RegistryKey = Registry.LocalMachine.OpenSubKey(My.Settings.OutlookRegPath)
Val = Key.GetValue("Path")
Val = Val.Replace(";", "")
If Val.LastIndexOf("\") <> Val.Length - 1 Then
Val = Val & "\"
End If
Catch ex As Exception
Log.Add("Unable to get registry value for Outlook: " & ex.Message)
Throw New Exception("Unable to get registry value for Outlook: " & ex.Message)
End Try
Else
Val = My.Settings.OutlookAppPath
End If
Log.Add("GetOutlookPath: " & Val)
Return Val
End Function
I tried replacing the values of Settins variables with actual content to try, but nothing works. Can anyone please help me know how do I set the path values and make it work on all Win OS. This code was working in Win 7, but with Win 10 it's giving a hard time. The arguments passed in Process also gives a hard time.
Thanks
Continue reading...