A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

VB question (Reply, Select All, Copy, and close email)



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 2nd 13, 09:45 PM
BrentLaftin BrentLaftin is offline
Junior Member
 
First recorded activity at Outlookbanter: Jan 2013
Posts: 2
Default VB question (Reply, Select All, Copy, and close email)

Hi,

I'm trying to code Outlook to Reply, Select All, Copy, then close an email. I can make the below code work perfectly if I don't have the Reply code in the script, when I add the Reply code it stops working.

I'm using this code to quickly copy all contents of a selected email so I can paste into a note record in my work system. I was also hoping to add a line of dashes "------------------------------" between each individual email (header) but that's way above my head.

Any help would be greatly appreciated, here's the code I'm struggling with:

Sub CopyAll_and_openSite()
Dim objApp
Dim objInsp
Dim colCB
Dim objCBB
On Error Resume Next

Set objApp = GetObject("", "Outlook.Application")
If objApp Is Nothing Then
Set objApp = Application.CreateObject("Outlook.Application")
End If
Set objInsp = objApp.ActiveInspector
If TypeName(objInsp) = "Nothing" Then
MsgBox "No inspector window found"
Exit Sub
Else
Set colCB = objInsp.CommandBars

Set objCBB = colCB.FindControl(, 354) ' Reply
objCBB.Execute

Set objCBB = colCB.FindControl(, 3634) ' clear clipboard
objCBB.Execute

Set objCBB = colCB.FindControl(, 756) ' select all
objCBB.Execute

Set objCBB = colCB.FindControl(, 19) ' copy
objCBB.Execute

Set objCBB = colCB.FindControl(, 2011) ' Close email
objCBB.Execute

End If

Set objCBB = Nothing
Set colCB = Nothing
Set objInsp = Nothing
End Sub
Ads
  #2  
Old February 8th 13, 07:19 PM
BrentLaftin BrentLaftin is offline
Junior Member
 
First recorded activity at Outlookbanter: Jan 2013
Posts: 2
Default

I was able to piece together a solution to this question and thought I'd post here in case anyone has a need:

Sub CopyAll_and_openSite()
Dim objApp
Dim objInsp
Dim colCB
Dim objCBB
On Error Resume Next

Set objApp = GetObject("", "Outlook.Application")
If objApp Is Nothing Then
Set objApp = Application.CreateObject("Outlook.Application")
End If
Set objInsp = objApp.ActiveInspector
If TypeName(objInsp) = "Nothing" Then
MsgBox "No inspector window found"
Exit Sub
Else
Set colCB = objInsp.CommandBars

Set objCBB = colCB.FindControl(, 354) ' Reply
objCBB.Execute

End If

Set objCBB = Nothing
Set colCB = Nothing
Set objInsp = Nothing

Set objApp = GetObject("", "Outlook.Application")
If objApp Is Nothing Then
Set objApp = Application.CreateObject("Outlook.Application")
End If
Set objInsp = objApp.ActiveInspector
If TypeName(objInsp) = "Nothing" Then
MsgBox "No inspector window found"
Exit Sub
Else
Set colCB = objInsp.CommandBars

Set objCBB = colCB.FindControl(, 3634) ' clear clipboard
objCBB.Execute

Set objCBB = colCB.FindControl(, 756) ' select all
objCBB.Execute

Set objCBB = colCB.FindControl(, 19) ' copy
objCBB.Execute

Set objCBB = colCB.FindControl(, 2011) ' Close email
objCBB.Execute

End If

Set objCBB = Nothing
Set colCB = Nothing
Set objInsp = Nothing

End Sub

Cheers,

Brent
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Select/Copy/Paste issue Mark[_11_] Outlook - General Queries 1 August 19th 09 02:19 PM
Outlook 2000 - Document Owner Email Reply Question MHenry Outlook - General Queries 2 January 6th 09 11:01 PM
Outdook 2003 won't close original message on reply Marius Kaizerman Outlook - General Queries 3 May 9th 07 08:35 PM
Newbie question: How to copy an email item from inbox to a folder Marceepoo Outlook and VBA 1 November 1st 06 07:54 PM
O2K3 SP2 Close on reply and forward Betelgeuse Outlook - General Queries 0 October 10th 06 09:12 PM


All times are GMT +1. The time now is 04:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.