Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to create email footer from AD, BUT skip lines depending on value

Status
Not open for further replies.

DVHITMAN

Technical User
Jun 19, 2013
12
GB
Hi,

I have VBA script, that runs on login, that create and sets a default the users email footer by pulling there information from the AD
Code:
	' ############ inserts contact details.
	objSelection.Font.Name = "Arial" 
	objSelection.Font.Size = 11 
	objselection.Font.Bold = true 
	objSelection.Font.Color = RGB (130,000,036)
	objselection.typetext vbtab &vbtab &"    D  "
	objselection.Font.Bold = false
	objSelection.Font.Color = RGB (008,096,106)
	objselection.typetext strPhone
	objselection.TypeText Chr(11)
	objselection.Font.Bold = true 
	objSelection.Font.Color = RGB (130,000,036)
	objselection.typetext vbtab &vbtab &"    T  "
	objselection.Font.Bold = false
	objSelection.Font.Color = RGB (008,096,106)
	objselection.typetext strDDI
	objselection.TypeText Chr(11)
	objselection.Font.Bold = true 
	objSelection.Font.Color = RGB (130,000,036)
	objselection.typetext vbtab &vbtab &"    W  "
	objselection.Font.Bold = false
	objSelection.Font.Color = RGB (008,096,106)
	objselection.typetext strWeb
	objselection.TypeText Chr(11)
	objselection.Font.Bold = true 
	objSelection.Font.Color = RGB (130,000,036)
	objselection.typetext vbtab &vbtab &"    A  "
	objselection.Font.Bold = false
	objSelection.Font.Color = RGB (008,096,106)
	objselection.typetext strAddress1 & ", " &strAddress2 & ", " &strAddress3 & ", " &strPostcode

D = Direct Line
T = Generic business telephone number
W = web address
a = postal address

...HOWEVER, no everyone has a D (Direct Address).

Can I add a IF THEN ELSE in that checks the valus of strPhone, and if N/A or empty, then skip adding that line to the footer ?

thanks in advance
 
WYI:

the code

Code:
If Len(strPhone) > 0 Then
	objSelection.Font.Name = "Arial"
	objSelection.Font.Size = 11
	objselection.Font.Bold = true
	objSelection.Font.Color = RGB (130,000,036)
	objselection.typetext vbtab &vbtab &" D "
	objselection.Font.Bold = false
	objSelection.Font.Color = RGB (008,096,106)
	objselection.typetext strPhone
	objselection.TypeText Chr(11)
End If

works like a dream
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top