View Single Post
  #2  
Old October 22nd 09, 12:29 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default getting the name of the pst file

In Outlook 2007, use the Folder.Store.FilePath property. In earlier
versions, you can hack it from the StoreID; see
http://www.outlookcode.com/codedetail.aspx?id=1434
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Russ" wrote in message
...
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
--
russ



Ads