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
L Android Outlook Doesn't Update PC Notification Changes Using Outlook 0
A How to open Excel file saved in Outlook folder? Outlook VBA and Custom Forms 4
D.Moore Outlook desktop client suggested searches question Using Outlook 11
Y Outlook 2016 (64-bit) Copy Local Cal. Events to Another Cal. with Modified Reminder time Using Outlook 2
T Outlook 2019 While connecting an IMAP account in "classic" Outlook 2024 I caused a massive duplication of emails on the server (death loop) Using Outlook 5
D Cannot logon to Outlook.com, or outlook on Mac, outlook not updating on ipad, iphone Using Outlook 1
J unable to get my new install of Outlook to display mailboxes in the single-line format. Using Outlook 1
D Legacy Microsoft Outlook for Mac Support will end in Oct 2025 Using Outlook 5
C Nasty Bug Lurking In Outlook For Years. The Trigger. Any Fix Or Workaround? Using Outlook 11
R Auto clicking Hyperlink in outlook Outlook VBA and Custom Forms 7
ughlook Open multiple contacts in NEW Outlook? Using Outlook 3
G Outlook translation feature is off Using Outlook 2
J Outlook 2010 does not let me put any account Using Outlook.com accounts in Outlook 3
P 3 of 5 PST files don't install from d:\outlook but only from D:\ Using Outlook 7
HarvMan January Windows 10 preview update force installs new Outlook Using Outlook 1
L Outlook 2010 - new installation on Windows 11 - aplzod32.dll is not a valid Add-in Using Outlook 12
J Outlook troubleshooting/logging - option grayed out Using Outlook 2
B Arrows missing from Outlook emails vertical scrollbar Using Outlook 0
G Outlook 2021 (New) doesn't respect default browser Using Outlook 9
B Outlook or iPhone turning tabs into spaces in Outlook Notes Using Outlook 1
P newly installed Office 365 includes OLD Outlook Using Outlook 6
R Outlook ribbon menu default? Using Outlook 7
H Spam email in Gmail not visible in Outlook Using Outlook 3
J How to transfer Win 10 Outlook to new Windows 11 pc? Using Outlook 16
J Renegade spam URL line displayed in old local Outlook 365 email title Using Outlook 3
G Reduce whitespace in Outlook desktop Contact Cards display Using Outlook 3

Similar threads

Back
Top