+ Reply to Thread
Results 1 to 2 of 2

I want a better solution

Hybrid View

  1. #1
    Registered User
    Join Date
    06-16-2005
    Posts
    34

    I want a better solution

    I wrote this football pool program which autoemails everyone in the pool sheets for them to put their picks on. They then email it back (saving the file as unique name so the program can automatically pick it up). The problem is:
    a) The person in charge of the pool has to take each email (from 30 ppl) and store the attached sheet in a special location.
    b) People keep changing the file name, which means that the main program, when compiling the picks into a master document, "doesnt find it".

    I thought about adding an 'email back' button on each personal picks sheet, but then they have to toy with enabling macros and setting security levels (which i dont want to do for them)

    Any thoughts for a better solution? Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    I've done something similar.

    For a) I automated Outlook from Excel, saving the email attachments to a folder, see http://www.*****-clicks.com/Excel.htm
    The answer to b) is not to rely on each sheet having an exact name. I used FileSystemObject To process all Excel files in a folder, see code snippet:
    (Set a reference to Microsoft Scripting Runtime to use FSO)
    Sub ProcessSheets()
    Dim oFSO as New FileSystemObject
    dim sFolder as String
    dim oFolder as Object, oFile as Object, oFiles as Object
    dim sceWB as Workbook
    
    sFolder = ThisWorkbook.Path & "\"
    
    Set oFolder = oFSO.GetFolder(sFolder)
    Set oFiles = oFolder.Files
    
    For Each oFile in oFiles
    If oFile.Type = "Microsoft Excel Worksheet" Then
    Set sceWB = Workbooks.Open(FileName:=oFile.Path)		'open workbook
    'Copy stuff to master workbook here
    sceWB.Close
    End If
    Next oFile
    
    Set oFolder = Nothing
    Set oFile = Nothing
    Set oFiles = Nothing
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1