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

Outlook VB help required

Status
Not open for further replies.

Scarrott

Programmer
Jan 17, 2002
4
EU
I have used macro's before but never programmed in VB (VB 6 in this case). What I need is a macro which I can run in Outlook. The macro needs to be made so that clicking a button adds the text ' - chkd' to the end of the subject line and then sends the message. Probably ridiculously simple to all you lot, but i'd be most grateful for your pearls of wisdom!!!

Thanks
 
I have managed to move on quite a bit since i posted the previous message but am still stuck.

What I want is to be able to click one button to send emails as normal (i.e., the send button) and create another one next to that which I can click which will add the text ' - chkd' to the end of the subject line and then send the email. I have been sent the code

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Item.Subject = Item.Subject & " - chkd"
End Sub

which I was told to put in the 'ThisOutlookSession' area. This did what I wanted, but it does it to all emails. How can I alter this so that I can create a separate macro to perform this.

Please keep it in laymans terms as I genuinely have little clue about VB!

Thanks a lot for any help.
 
Well I'm fairly new to vb so if this idea is stupid, I don't mind you saying so.
Suppose you declared a public variable in your declarations and set the value of that variable in your button_click event?

Private Sub Button1_Click()
myString = Item.Subject & " - chkd"
'Do whatever then call your sub
End Sub
Private Sub Button2_Click()
myString = Item.Subject
'Do whatever then call your sub
End Sub

Then use the variable in your send sub.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Item.Subject = myString
End Sub
 
I'm sure that's great, but as i say, i have no clue about programming in VB so i don't actually know what to do with what you've just given me! There was no chance of me laugh because it's a whole lot better than i could do!!!

Thanks a lot for trying anyway! X-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top