FYI - I used
VB.net, Im sure from this you can fiqure what i did
Dim xl As Excel.Application
Try
xl = CType(GetObject(Nothing, "Excel.Application"), Excel.Application)
Catch ex As Exception
End Try
Try
If xl Is Nothing Then
xl = New Excel.Application
End If
With ofd
.DefaultExt = "*.Xls"
.AddExtension = True
.Filter = "Mikerosoft (*.xls)|*.xls"
.CheckFileExists = True
.CheckPathExists = True
.Multiselect = False
.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolde r.Recent)
If ofd.ShowDialog = DialogResult.OK Then
xl.Workbooks.Open(ofd.FileName())
xl.Visible = True
xl = Nothing
GC.Collect()
End If
End With
Catch ex As Exception
MsgBox(ex.Message, , code.m)
End Try
'Environment.GetFolderPath(Environment.SpecialFold er.Recent)
End Sub