OL2003 & VB6:- "Could not send the message"

  • Thread starter Thread starter Womble
  • Start date Start date
Status
Not open for further replies.
W

Womble

I've got some code that I'm changing the reply method for.

In order to ensure the original message is not changed, I'm creating a copy

of the item but with the reply method I get a "Could not send the message" -

any thoughts. An extract from the relevent section:-

Set CurrMail = application.ActiveInspector.CurrentItem

Set NewMail = CurrMail.Copy()

Set NewFwd = NewMail.Reply

NewFwd.Display

I know it's the .Reply because if I replace NewMail.Reply with

Currmail.reply it works perfectly.
 
Does it work better if you save the new copied item before calling Reply on

it?

"Womble" <Womble> wrote in message

news:544A949A-B5F0-49EA-84EC-DF38618938FB@microsoft.com...
> I've got some code that I'm changing the reply method for.

> In order to ensure the original message is not changed, I'm creating a
> copy
> of the item but with the reply method I get a "Could not send the
> message" -
> any thoughts. An extract from the relevent section:-

> Set CurrMail = application.ActiveInspector.CurrentItem

> Set NewMail = CurrMail.Copy()

> Set NewFwd = NewMail.Reply

> NewFwd.Display

> I know it's the .Reply because if I replace NewMail.Reply with
> Currmail.reply it works perfectly.
 
Saving it first i.e. NewMail.Save makes no difference. I still get the same

error.
wrote:


> Does it work better if you save the new copied item before calling Reply on
> it?

> >

>

> "Womble" <Womble> wrote in message
> news:544A949A-B5F0-49EA-84EC-DF38618938FB@microsoft.com...
> > I've got some code that I'm changing the reply method for.
> > In order to ensure the original message is not changed, I'm creating a
> > copy
> > of the item but with the reply method I get a "Could not send the
> > message" -
> > any thoughts. An extract from the relevent section:-
> > Set CurrMail = application.ActiveInspector.CurrentItem
> > Set NewMail = CurrMail.Copy()
> > Set NewFwd = NewMail.Reply
> > NewFwd.Display
> > I know it's the .Reply because if I replace NewMail.Reply with
> > Currmail.reply it works perfectly.


>
 
Then I'm inclined to think it's a timing problem. If putting a DoEvents in

between saving the item and calling Reply doesn't do the trick then after

saving get NewItem.EntryID, release all references to the objects and get a

new object using the saved EntryID and NameSpace.GetItemFromID() and see if

that does the trick.

"Womble" <Womble> wrote in message

news:01AC813E-780D-4A71-8A7F-34064E2915E7@microsoft.com...
> Saving it first i.e. NewMail.Save makes no difference. I still get the
> same
> error.
 
Ken,

Thanks for that, the DoEvents didn't work. But the GetItemFromID() approach

did.

Unfortnatly, that moved me onto another hurdle.

The reason I'm copying is that I'm modifying the reply method, and wanted to

ensure that the original item was not affected. And this works fine as I

expected - except when I have an open attachment. The Currmail.Copy code

gives me a "An attachment to this message may be currently open in another

program......" message.

If I click YES to continue, the codes works fine. If NO, then NewMail is

empty and the code falls over with Object Expected.

Any thoughts, as to how I can work around this.
wrote:


> Then I'm inclined to think it's a timing problem. If putting a DoEvents in
> between saving the item and calling Reply doesn't do the trick then after
> saving get NewItem.EntryID, release all references to the objects and get a
> new object using the saved EntryID and NameSpace.GetItemFromID() and see if
> that does the trick.

> >

>

> "Womble" <Womble> wrote in message
> news:01AC813E-780D-4A71-8A7F-34064E2915E7@microsoft.com...
> > Saving it first i.e. NewMail.Save makes no difference. I still get the
> > same
> > error.


>
 
Umm, don't open the attachment?

Or handle the AttachmentRead() event on that item. That will tell you the

attachment was opened, use that to get the hWnd of the attachment window

using a Win32 API call such as FindWindow(), then send or post a WM_CLOSE

message to that window when you want to close the attachment window.

"Womble" <Womble> wrote in message

news:BC2A59D2-206C-48E9-A968-BA2ADC9DF831@microsoft.com...
> Ken,

> Thanks for that, the DoEvents didn't work. But the GetItemFromID()
> approach
> did.

> Unfortnatly, that moved me onto another hurdle.

> The reason I'm copying is that I'm modifying the reply method, and wanted
> to
> ensure that the original item was not affected. And this works fine as I
> expected - except when I have an open attachment. The Currmail.Copy code
> gives me a "An attachment to this message may be currently open in another
> program......" message.

> If I click YES to continue, the codes works fine. If NO, then NewMail is
> empty and the code falls over with Object Expected.

> Any thoughts, as to how I can work around this.
 
Unfortunatlly asking the users to close the attachment before clicking the

new button isn't really an option - similar with getting the code to close

the attachment prior to the copy.

Because I'm trying to code my own reply behaviour within an attatchment i.e.

I want to Create a "Reply with History" button while leaving the default

behaviour of Outlook to be Reply without history. Therefore when I had

issues around the behviour of Outlook when changing the properties of the

email, I felt that copying the item was the best approach.

Anu thoughts as to how Outlook manage it, because it's own reply button

doesn't prompt about an item being open when I use it's button.
wrote:


> Umm, don't open the atachment?

> Or handle the AttachmentRead() event on that item. That will tell you the
> attachment was opened, use that to get the hWnd of the attachment window
> using a Win32 API call such as FindWindow(), then send or post a WM_CLOSE
> message to that window when you want to close the attachment window.

> >

>

> "Womble" <Womble> wrote in message
> news:BC2A59D2-206C-48E9-A968-BA2ADC9DF831@microsoft.com...
> > Ken,
> > Thanks for that, the DoEvents didn't work. But the GetItemFromID()
> > approach
> > did.
> > Unfortnatly, that moved me onto another hurdle.
> > The reason I'm copying is that I'm modifying the reply method, and wanted
> > to
> > ensure that the original item was not affected. And this works fine as I
> > expected - except when I have an open attachment. The Currmail.Copy code
> > gives me a "An attachment to this message may be currently open in another
> > program......" message.
> > If I click YES to continue, the codes works fine. If NO, then NewMail is
> > empty and the code falls over with Object Expected.
> > Any thoughts, as to how I can work around this.


>
 
I have no idea how Outlook does things like that internally. For a reply the

attachments on the original message are always stripped out anyway though,

so that is likely the answer. You might want to look at saving any

attachments that you want on the reply to a temp folder in the file system,

then adding them to the reply message rather than making a copy of the

original message.

"Womble" <Womble> wrote in message

news:D34C3FA7-4F42-40A0-80CB-7ECA36F42A49@microsoft.com...
> Unfortunatlly asking the users to close the attachment before clicking the
> new button isn't really an option - similar with getting the code to close
> the attachment prior to the copy.

> Because I'm trying to code my own reply behaviour within an attatchment
> i.e.
> I want to Create a "Reply with History" button while leaving the default
> behaviour of Outlook to be Reply without history. Therefore when I had
> issues around the behviour of Outlook when changing the properties of the
> email, I felt that copying the item was the best approach.

> Anu thoughts as to how Outlook manage it, because it's own reply button
> doesn't prompt about an item being open when I use it's button.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
T From OL2010 Pro to OL2003 Pro Using Outlook 4
J OL2003 (HTTP proxy) update time Exchange Server Administration 7
P migration issue from OL2003 to OL2010 with custom contact form Using Outlook 7
J OL2003 Public Folder Sync Errors w/ Exchange 2010 Exchange Server Administration 11
S OL2003 labels in OL2010 Using Outlook 7
J OL2003 Macro disables itself - looking for way to automate 'enable' Using Outlook 2
M Develop for OL2003 on OL2007 machine using VS2008 and VSTO? Outlook VBA and Custom Forms 1
C Cannot access macro menu in OL2003 Outlook VBA and Custom Forms 2
C Converting users with BCM in OL2003 to RPC over HTTP BCM (Business Contact Manager) 1
E FUNCTION SEND/RECEIVE OUTLLOK AND VB6 Outlook VBA and Custom Forms 3
J VB6 Add-in fails to load in Outlook 16 - message useless Outlook VBA and Custom Forms 4
A vb6 run time error 5 when Outlook 2007 Explorer object displayed Outlook VBA and Custom Forms 1
R Sending email using VB6 Outlook VBA and Custom Forms 1
Y Encode TNEF file with VB6 Outlook VBA and Custom Forms 1
Q VB6 to VB.Net Migration Outlook VBA and Custom Forms 3
P Removing Outlook 365 Account from Send/Receive Using Outlook 1
J Outlook macro to run before email is being send Outlook VBA and Custom Forms 0
J Saving Send emails to a folder on the server Outlook VBA and Custom Forms 63
J Outlook 2019 Pick the Folder Location to save send emails Outlook VBA and Custom Forms 0
D Send email from Outlook Alias using Mac? Using Outlook 0
R How to use VB .Net to send emails? Outlook VBA and Custom Forms 0
J Outlook VBA to send from Non-default Account & Data Files Outlook VBA and Custom Forms 4
C Synchronization and taking forever to send Using Outlook 2
D Send on behalf of does not store the base mailbox Using Outlook 0
R Outlook 365 VBA AUTO SEND WITH DELAY FOR EACH EMAIL Outlook VBA and Custom Forms 0
S Outlook 2002- "Send" button has disappeared. Help please. Using Outlook 1
TomHuckstep Remove Send/Receive All Folders (IMAP/POP) button from Outlook 365 Ribbon Using Outlook 2
J Macro to send email as alias Outlook VBA and Custom Forms 0
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
T Outlook 2010 recipient no longer shows in 'Send To' Using Outlook 0
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
E Outlook - Macro - send list of Tasks which are not finished Outlook VBA and Custom Forms 3
L How to avoid issues with "Send on Behalf" Using Outlook 3
M Outlook 365 refuses to send email Using Outlook 0
A Change settings Send/receive VBA Outlook VBA and Custom Forms 0
M I cant send emails via Outlook in my W10 PC. Using Outlook 3
K Run a script rule to auto 'send again' on undeliverable emails? Outlook VBA and Custom Forms 1
G Send a greeting message to a contact on birthday Outlook VBA and Custom Forms 5
T Outlook creates a copie of every mail I send Using Outlook.com accounts in Outlook 4
R How to restrict GWSMO sync to Outlook Send/Receive cycles Using Outlook 0
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
A Unflag Inbox and Flag Inbox with Orange Category After Item is send Outlook VBA and Custom Forms 3
glnz O365 - How to send from acct 2 but showing email name from acct 1 as From - alias? Using Outlook 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
PGSystemTester VBA To Change AppointmentItem.BusyStatus From MeetingItem Before Send Using Outlook 0
C Synchronizing subscribed folders causes hanging during send/receive process Using Outlook 2
M Extract all links from Outlook email, send to Excel Using Outlook 2
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1

Similar threads

Back
Top