PDA

View Full Version : help with folder view



dinotom
11-21-2009, 04:53 AM
Hello,
I dont code much for outlook but I now have a routine that takes the attachments i need to import into my excel sheets, stores them in a folder where my excel import routine can find them. I am trying to write some code to tell excel to open outlook and run the send/receive all,so outlook can run the attachment routine.

the code below is where I am currently but is breaking on the bolded line
Stepping through shows objFolder = to "Inbox" so im not sure why its breaking there (run time error 438, object doesn't support this property or method)



Sub DoThisonOpen()
Dim objApp As New Outlook.Application
Dim objNS As Object, objTemp As Object
Dim objFolder As Object, objExplorer As Object
Dim btnSendReceive As Office.CommandBarButton

Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olFolderInbox)
Set objExplorer = objApp.Explorers
objExplorer.CurrentFolder = objFolder
objExplorer.CurrentView = "Messages"
objExplorer.Display
'Set objFolder = OutlookFolderNames(objTemp, "XTrader Export")
'Set
'close outlook if its already open, so I can reopen and do send/receive all
objApp.Quit
objFolder.Display

End Sub