sgtschultz
05-16-2012, 11:35 AM
Our computers were recently removed from a network domain. One of our computers was also being used to receive faxes. The faxes come in as Tiff files into a folder on the desktop. A macro had been written (not by me) in Outlook that moved the files from the folder in to Outlook's inbox, and then sent them as an attachment in a email to a distribution list.
When we were taken off the domain, the code was no longer there, but i had a copy of it. We set up a new email account, and I pasted in the code, but it doesn't work. I don't get an error, it just doesn't do anything. The old email was on Microsoft Exchange Server, now we are using a POP server (if that matters)
We are using XP and Outlook 2003.
I know nothing about coding or macros, but I am hoping there is some obvious easy solution to this -- or an alternate solution to dispersing faxes to multiple email addresses.
Here is the code that i pasted in, thanks in advance for any help:
Private Sub Application_Startup() 'do when application starts
EnableTimer 60000, Me '60000 milliseconds (= 1 minute)
End Sub
Public Sub Timer()
' This code is Called from the timer
Dim varFileArray As Variant
Dim lngI As Long
Dim strDirName As String
Dim flname As String
Dim flLocation As String
Const NO_FILES_IN_DIR As Long = 9
Const INVALID_DIR As Long = 13
On Error GoTo Test_Err
strDirName = "C:\Documents and Settings\Tandem New Account\Desktop\FAXRECD"
varFileArray = GetAllFilesInDir(strDirName)
For lngI = 0 To UBound(varFileArray)
flname = varFileArray(lngI)
Dim objMsg As MailItem
' create new outgoing message
Set objMsg = Application.CreateItem(olMailItem)
' e-mail information
objMsg.To = "xxxxxxxxxxxx@gmail.com"
objMsg.Subject = "FAX FAX FAX"
'add attachment
objMsg.Attachments.Add (strDirName & "\" & flname)
' send the message and move to sent items folder
objMsg.Send
'create file location string
flLocation = strDirName & "\" & flname
'First remove readonly attribute, if set
SetAttr flLocation, vbNormal
'Then delete the file
Kill flLocation
'reset the variable to Null
Set objMsg = Nothing
'move to next record
Next lngI
Test_Err:
'If no files exist in the desiginated
End Sub
Private Sub Application_Quit() 'do when application closes
DisableTimer
End Sub
When we were taken off the domain, the code was no longer there, but i had a copy of it. We set up a new email account, and I pasted in the code, but it doesn't work. I don't get an error, it just doesn't do anything. The old email was on Microsoft Exchange Server, now we are using a POP server (if that matters)
We are using XP and Outlook 2003.
I know nothing about coding or macros, but I am hoping there is some obvious easy solution to this -- or an alternate solution to dispersing faxes to multiple email addresses.
Here is the code that i pasted in, thanks in advance for any help:
Private Sub Application_Startup() 'do when application starts
EnableTimer 60000, Me '60000 milliseconds (= 1 minute)
End Sub
Public Sub Timer()
' This code is Called from the timer
Dim varFileArray As Variant
Dim lngI As Long
Dim strDirName As String
Dim flname As String
Dim flLocation As String
Const NO_FILES_IN_DIR As Long = 9
Const INVALID_DIR As Long = 13
On Error GoTo Test_Err
strDirName = "C:\Documents and Settings\Tandem New Account\Desktop\FAXRECD"
varFileArray = GetAllFilesInDir(strDirName)
For lngI = 0 To UBound(varFileArray)
flname = varFileArray(lngI)
Dim objMsg As MailItem
' create new outgoing message
Set objMsg = Application.CreateItem(olMailItem)
' e-mail information
objMsg.To = "xxxxxxxxxxxx@gmail.com"
objMsg.Subject = "FAX FAX FAX"
'add attachment
objMsg.Attachments.Add (strDirName & "\" & flname)
' send the message and move to sent items folder
objMsg.Send
'create file location string
flLocation = strDirName & "\" & flname
'First remove readonly attribute, if set
SetAttr flLocation, vbNormal
'Then delete the file
Kill flLocation
'reset the variable to Null
Set objMsg = Nothing
'move to next record
Next lngI
Test_Err:
'If no files exist in the desiginated
End Sub
Private Sub Application_Quit() 'do when application closes
DisableTimer
End Sub