getting the name of the pst file

  • Thread starter Thread starter Russ
  • Start date Start date
R

Russ

Does anyone know the line of code line that will return the name of the pst
file currently selected. Below is part of the code that precedes where I
want to insert the line to get the pst file name

Sub ExportToExcel()

On Error GoTo ErrHandler

Dim appExcel As Excel.Application
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet
Dim rng As Excel.Range
Dim strSheet As String
Dim strPath As String
Dim intRowCounter As Integer
Dim intColumnCounter As Integer
Dim msg As Outlook.MailItem
Dim nms As Outlook.NameSpace
Dim fname As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder
Dim itm As Object

strSheet = "email recovery.xlsx"
strPath = "D:\Mod 50 project\pst files Mod 50 project\"
strSheet = strPath & strSheet
'Debug.Print strSheet

'Select export folder
Set nms = Application.GetNamespace("MAPI")
Set fld = nms.PickFolder
'I want to insert the line here'
'more code follows to put the fields in the email messages in the folder
'fld' into an Excel spreadsheet
 
Sue,
Thanks works perfectly. It is a bit more than the one line I thought it
would be. God knows how long it would have taken me on my own.
Again, many thanks.
 
Back
Top