Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

Error message when saving a message

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HomeroOM - 19 Mar 2008 20:41 GMT
I've created a simple piece of VBA code, intending to save a message
programmtically created.

The code follows:
----------------
  Dim A As Application
  Dim M As MailItem
  Dim R As Recipient

  Set A = Application
 
  Set M = A.CreateItem(olMailItem)

  M.Body = "this is a single message testing."

  Set R = M.Recipients.Add("homero_magajewski@banrisul.com.br")

  R.Type = olOriginator

  M.Subject = "Mensagens para arquivar"

  Set R = M.Recipients.Add("hon@terra.com.br")

  R.Type = olTo
 
  M.Save
 
  Set A = Nothing
  Set M = Nothing
  Set R = Nothing
--------------

On the 'M.Save' statement, i'm getting an error message (what you see bellow
is a free translation, because I'm using Outlook in Portuguese:
--------
It was not possible to end the operation. There are one or more invalid
parameter value.
--------

Can you help me to figure what's going on?

Thanks
Signature

HomeroOM

Eric Legault [MVP - Outlook] - 19 Mar 2008 21:11 GMT
That is strange - it works fine for me.  What version of Outlook?

The only thing I can think of doing is to fully qualify your variables when
you declare them (i.e. Dim A As Outlook.Application).  Also try M.Display and
don't call save, and see if you can send or save it manually.

Signature

Eric Legault - Outlook MVP, MCDBA, MCTS (SharePoint programming, etc.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/

> I've created a simple piece of VBA code, intending to save a message
> programmtically created.
[quoted text clipped - 38 lines]
>
> Thanks
HomeroOM - 19 Mar 2008 22:24 GMT
Dear Eric

I've tried and it didn't work.

The message occurs, though, after the yes answer to a message box asking me
to save the message.

The A.Display worked OK.

The code I've posted is very simple and so is my intent.

Some things, for simplicity puposes only, I've ommited:

1. I invoke the code through an optin button in a User Form.
The code is:
-----------
Private Sub optEviaMsgAnexadas_Click()

  modUtilitários.PrepararRemessaDeMensagens

End Sub
-----------
2. Although Outlook is installed in my PC, the PC is connected to a
microsoft network.

The macro I've used to show the form is:
----------
Public Sub PrepararEmails()

  frmPreparaMensagens.Show vbModeless
 
End Sub
----------

The vbModeless constant was necessary because the display worked on my
debbuging session (inside VBA IDE) and issued the same message that Save is
issuing when I was invoking from a buttom on my Outlook toolbar.

Thanks for your super fast answer.

Keep up the good work

Homero

Signature

HomeroOM

> That is strange - it works fine for me.  What version of Outlook?
>
[quoted text clipped - 44 lines]
> >
> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.