LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default .Lookin through Outlook

Hi all,

I have some code that copies csv files from folder to folder but I
need to modify it to move the files from an Outlook folder to a normal
folder. I'm not experienced at all with any Outlook code in Excel so
any help would be appreciated!

Below is the part of code I'm having problems with.
I used some other code to get it started but my main issue is that
the .Lookin seems to keep defaulting to the users personal folder
instead of the path I give it.

Spath at the moment is the Outlook folder and SDestpath is the normal
folder I want the files moved to.
I just can't get the code to reset the .lookin and use the Spath
instead!

Function iWorkbooksPosted() As Integer

Dim olApp As Outlook.Application, olFolder As Outlook.MAPIFolder,
_
olDocumentItem As Outlook.DocumentItem, olMailItem As
Outlook.MailItem, _
olAtt As Outlook.Attachment

Dim wdDoc As Word.Document, wdRng As Word.Range

Dim wbk As Workbook, wks As Worksheet, wksSource As Worksheet
Dim c As Range, Rng As Range
Dim sDestPath As String, strMailBody As String, sRegionID As
String, _
fn As String, sDataType As String, sFile As String, sPath As
String, _
sCSVFile As String, tempstr As String
Dim counter As Integer, vFileNum As Integer
Dim i As Long, j As Long, lRCount As Long, lDupes As Long, x As
Long
Dim bProcSuccess As Boolean

sDestPath = Worksheets("Main").Range("E1")
sPath = Worksheets("Main").Range("E2")

On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err.Number = 429 Then
Err.Clear
Set olApp = New Outlook.Application
End If

On Error GoTo ErrorHandler

With Application.FileSearch

.NewSearch
.LookIn = sPath
.FileType = msoFileTypeExcelWorkbooks
.Filename = "*.csv"
If .Execute 0 Then ' found workbooks in Temporary EOSR
folder
For x = 1 To .FoundFiles.Count
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
.LookIn problem 2007 John[_19_] Excel Programming 5 December 4th 09 04:00 AM
Cannot assign value to Filesearch.Lookin QQExcel Excel Programming 3 August 5th 04 04:20 PM
can not assign value to LookIn QQExcel Excel Programming 1 July 30th 04 07:44 PM
Lookin Property. Simon[_14_] Excel Programming 3 April 20th 04 02:17 PM
Using a variable with .LookIn Mike Berry Excel Programming 0 July 14th 03 12:29 PM


All times are GMT +1. The time now is 05:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"