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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Outlook COM Add-In to Search/Replace Acct. Numbers

Status
Not open for further replies.

jcbirch

MIS
Dec 16, 2004
18
US
Hi,

Hope someone can help me. This challenge seems like a doozy to me, but I figure it would be very easy to someone who knew what they were doing. I have experience with SQL programming and using VB to automate Excel reports (formatting, page setups, etc.) but this is way above my head.

I work for a bank, and we have the need to check our outgoing email messages (and their attachments) for account numbers to ensure none of our employees are sending confidential information out of the company. I want to create an Outlook COM add-in. It should work kinda like spell-checker: the add-in should be invoked if the user clicks a button on a toolbar or tries to send an email. The add-in would then search through each word in the email body and all attachments; and if any potential account #s are found, the add-in should prompt the associate to replace each account number with something unrecognizable - kinda like you see for credit card numbers that show up as xxxx-xxxx-xxxx-#### on receipts.

I'm using Visual Basic version 6.3.

I have no idea how to do this! Here's a detailed list of what I think the steps should be. Any help with all/part of the process would be much appreciated!

1) Search all words in the Outlook email body (including original messages being replied to, etc.) for potential account numbers - i.e. any word containing 2+ numbers in the string. I was thinking about using VAL()>0 to find them. Not sure how to script that each word needs to be checked. I would imagine that a "word" is not simply character/number strings bounded by spaces, as they could also be separated by hard returns, commas, double quotes, etc. or any combination thereof.

2) For each potential account number found, highlight the original number, and prompt to replace with something unrecognizable, or "skip" if the word with numbers isn't an account number (such as an address).

3) As a default replacement, I'd like the add-in to suggest the original number (retaining all dashes, underscores, dots, etc.) substituting X's for all but the last 4 numbers. String lengths can vary. So for example, account AFB-4488 would be suggested as XXX-4488; account ABCDEFG.123456 would be suggested as XXXXXX.XX3456. The user could replace with the suggested text, "skip" the word, or replace the word with any other string of their choice.

4) Continue until all words have been checked.

5) Repeat the same process for any and all attachments.

6) Then either go back to the email or send the email, depending on whether the user clicked a toolbar button or tried to send the email to invoke the add-in.

7) After creating all the functionality above, I need to make it into a COM add-in that can work across multiple versions of Outlook (97, 2000, 2003, etc.).

Please help, if you can!
-Jessica
 
Well, are you able to do any of it? If so, perhaps you can boil your post down to the few places that you're stuck, and pull out all the extra stuff.

HTH

Bob
 
The problem is, I don't know how to form statements that define/call objects like words or emails or attachments or anything like that... so basically, I don't know where to start.

I figured there are probably lots of people out there who would be able to accomplish this in just a few lines of code. But maybe it really is as hard and open-ended as it seems like to me.

You know, don't worry about it. I'll just keep working on it on my own or buy some books or something.
 
Well, you've begun to boil it down. If you want to automate the Outlook application, take a look at this:
If you want to send and receive emails, you can investigate CDO.

If you want to know how to create and use COM objects in VB, check this FAQ: faq708-5940.

And finally, read faq222-2244 to get a better idea of why you're not getting the answers you're expecting.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top