reubendayal
Senior Member
- Outlook version
- Outlook 365 64 bit
- Email Account
- Office 365 Exchange
Hi All,
I have a macro we use to copy several document templates based on the company we are assisting. So for now it has worked just fine by using several IF statements based on each company. Here's an example:
… (continues like this for 15 different companies)
Now we have 20 more companies to add that just makes this code that much more longer with this approach.
Secondly, every time a team member changes the file location/name of the network folders even slightly it breaks the code.
So I've been wondering if I must simply put these network address in a common excel sheet so the team members can keep that updated if there are any modifications required. Also, it makes the updating of names less complicated for non-programmers. The obvious fact remains that if anyone mistakenly deletes the excel file or changes things in an incorrect manner, then the code breaks again.
I've also thought that perhaps the above code can be made in to a function to prevent the same lines of code being repeated each time. But I do not have the skills to put that together.
Any advice will be much appreciated!
Thank you.
I have a macro we use to copy several document templates based on the company we are assisting. So for now it has worked just fine by using several IF statements based on each company. Here's an example:
Code:
If Employer = "Apple" Then
SFolder = "S:\Network Location\Company Folders\Cases\"
EmployerTempLink = "S:\Network Location\Company Folders\Cases\Templates\"
EmployerQstName = "Questionnaire.xlsx"
EmployerDecName = "Declaration.pdf"
POAlink = "S:\Network Location\Company Folders\Cases\"
POAName = "Letter.pdf"
Apple = True
ElseIf Employer = "Orange" Then
Now we have 20 more companies to add that just makes this code that much more longer with this approach.
Secondly, every time a team member changes the file location/name of the network folders even slightly it breaks the code.
So I've been wondering if I must simply put these network address in a common excel sheet so the team members can keep that updated if there are any modifications required. Also, it makes the updating of names less complicated for non-programmers. The obvious fact remains that if anyone mistakenly deletes the excel file or changes things in an incorrect manner, then the code breaks again.
I've also thought that perhaps the above code can be made in to a function to prevent the same lines of code being repeated each time. But I do not have the skills to put that together.
Any advice will be much appreciated!
Thank you.