How to update file names when the file names contain specific string referenced from an excel table?

Status
Not open for further replies.

weijianhk

New Member
Joined
Feb 27, 2015
Messages
18
Hi Guys,

I need some help here please!. I have created a fully functional outlook macro, that downloads Outlook attachments to OneDrive specified folder. So the macro would update the file name with the email domain and month/year e.g. from original attachment name "Invoice_GBR_Z-GRX_2019_07.pdf" it becomes "comfone.com_08-2019___Invoice_GBR_Z-GRX_2019_07.pdf" after executing the macro.

However, I would like the macro to also have the ability to compare against a static excel table called Table.xls on my desktop (2 columns where column A contain the email domain name, and column B containing its respective company code), wherein if the excel cell contains "comfone.com", then its corresponding company code say 0001 would then be appended to the file name so the file name gets updated to "0001_comfone.com_08-2019___Invoice_GBR_Z-GRX_2019_07.pdf"

Is there any expert who could lend a hand and assist me please? I'm struggling quite a fair bit not knowing how to reference to an excel table from my outlook vba. Thanks a ton!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Status
Not open for further replies.

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top