VBScript Outlook, add attachment

Status
Not open for further replies.

kpoole

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server 2013
I have been working on several different vbscript codes to figure out my issues but to prevail. The macro is suppose to search a folder path then choose to correct file name and attach it to the outgoing email. Below is the part of the script I am having difficulty with. For some reason it keeps telling me Not found and I can't come up with a resolution. Also the "New Name" is written because everyday a new file is added for reports. (Ex: Kimrad Dispatch 08-22-2014.xlsx)

Sub SendAttachment()

Dim SOURCE_FOLDER As String
Dim NewName As String

SOURCE_FOLDER = "K:\Dispatch folder\High Sierra Dispatch Sheets\"
NewName = "Kimrad Dispatch " & Format("d", "mm-dd-yyyy") & " South" & ".xlsx"
Dim fileName As String
fileName = Dir(SOURCE_FOLDER & NewName)
If fileName = "" Then
MsgBox "Not found"
Exit Sub
End If
End Sub

PS, I this script code is just to see if it can find the file. (The rest of it doesn't matter if it can't even find it) Any suggestions would be greatly appreciated.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Outlook 2010 VBScript editor does not run code at all Outlook VBA and Custom Forms 0
B Recommended Outlook & VBScript Books? Outlook VBA and Custom Forms 3
H Accessing a control on a frame in Outlook with VBScript Outlook VBA and Custom Forms 1
N VBScript does not run in Outlook 2003 Outlook VBA and Custom Forms 4
A VBscript stops running after updating form Outlook VBA and Custom Forms 1
B VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
M VbScript for Command Button on Contacts Custom Form Using Outlook 1
M Forward Appointment as BCC with VBScript Outlook VBA and Custom Forms 7
D Security patch seems to kill vbscript on Enterprise Level Outlook VBA and Custom Forms 4
R VBScript Commands Outlook VBA and Custom Forms 2
Mark White VBScript Move sent mail to non-default folder Outlook VBA and Custom Forms 5
Mark White VBScript Move sent mail to non-default folder Outlook VBA and Custom Forms 0
S my vbscript button1_click code works on appointment created but not on opening an existing apntmn Outlook VBA and Custom Forms 16
JorgeDario Template oft that contains VBScript Is not running Using Outlook 1
T Create new item in public folder using VBscript Outlook VBA and Custom Forms 1
R VBScript Sendmail not selecting correct 'from' address Outlook VBA and Custom Forms 3
Mary B VBscript: Need to copy every email to a folder & mark that copy as read Outlook VBA and Custom Forms 5
S VBA Macro to VBScript Outlook VBA and Custom Forms 1
E VBScript to replace module? Using Outlook 3
F VBScript to add pre defined text Using Outlook 5
D Custom form and VBScript Using Outlook 5
F VBScript copy contacts and remove duplicates Using Outlook 1
R VBA Macro to VBScript in a form- Help Please! Using Outlook 10
Y Creating a Task with VBScript Outlook VBA and Custom Forms 14
Retired Geek Outlook for the MAC with Yahoo accounts now very broken Using Outlook 6
S Outlook 2002- "Send" button has disappeared. Help please. Using Outlook 1
L How Stop Outlook Nag Messages Using Outlook 1
TomHuckstep Remove Send/Receive All Folders (IMAP/POP) button from Outlook 365 Ribbon Using Outlook 1
L I Cannot Sign Into My Outlook Account? Outlook VBA and Custom Forms 0
icacream Outlook 2021 - Google calendar in the peek Using Outlook 0
e_a_g_l_e_p_i Question about installing my Gmail account on my iPhone but still getting messages downloaded to my desktop Outlook. Using Outlook 3
F Want to add second email to Outlook for business use Using Outlook 5
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
M using excel to sort outlook appointment items Outlook VBA and Custom Forms 4
e_a_g_l_e_p_i MY Outlook 2021 changed the format of the shortcuts for mail, calendar etc. Using Outlook 10
Z Outlook 2021 Outlook new emails notification not working Using Outlook 5
K Changing the Deleted Items location in Outlook 2019 Using Outlook 2
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
V How to use Comas in a picklist in Outlook forms Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Question about reinstalling Outlook 2021 Using Outlook 5
A Outlook 365 Outlook (part of 365) now working offline - argh Using Outlook 5
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
G LinkedIn tab missing in Outlook 365 (but working in OWA) Using Outlook 0
Jay Freedman Outlook forgets "not junk" marking Using Outlook 0
KurtLass Opening Graphics Attachments in Outlook 2021 Using Outlook 0
P now on office 365 but getting error messages about missing Outlook 2013 cache folders Using Outlook 2
B Outlook config download Outlook VBA and Custom Forms 1
M Short term workaround for when Outlook searching stopped functioning Using Outlook 0
D Outlook 2016 Creating an outlook Macro to select and approve Outlook VBA and Custom Forms 0
L Fetch, edit and forward an email with VBA outlook Outlook VBA and Custom Forms 2

Similar threads

Top