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

desperatly trying to save email message..



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 21st 06, 01:20 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default desperatly trying to save email message..

Isn't your code already launching it?
Add the following code immediately after retrieving objol:

set NS = objol.GetNamespace("MAPI")
NS.Logon

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"rocco" wrote in message
...
thanks both for your reply and for trying to help me.

For Sue:
well... Actually... I built this procedure some time ago (with minor
changes, just the fact that now you can choose the attach through a
FileDialog and that this time I'm using late binding) and also on other
pc's
it happens that the email was saved in the inbox folder. And somewhere I
have
found out that the INBOX is the default folder...by default? But I can be
(I
would if this will solve the issue) wrong.

For Dmitry:
since I'm kind of newbie with Outolook programming, can you please explain
what you meant? If you meant that I haven't an Outlook session running,
the
answer is yes. And I would like to be able to run my procedure without
having
to launch that application.

For both:
I really appreciate your efforts, but the procedure works just fine...it
hust the save methiod that doesn't fire. Again, if I wrote mssg.saveas and
hit enter, it changes into mssg.SaveAs which suggest that it understand
the
syntax. if I wrote mssg.save and hit enter...it stay mssg.save...


"Sue Mosher [MVP-Outlook]" wrote:

Actually...if I don't move they will be saved in the ...Inbox folder -
which
is the default folder. This at least happens on my pc...


You mean you have the Inbox set in Outlook as the default folder for
unsent messages? Wouldn't you want to honor the user's setting?

Why aren't you declaring an Outlook.Application object and
Outlook.MailItem object in these statements:

Dim objol As Object
Dim msgg As Object


Still looking for an answer here.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"rocco" wrote in message
...
Hello,
I have wrote code in Access to create an email message with an
attachment (
a .zip file choosen from user through a FileDialogPicker.
I would like to save the messa into the Draft folder...now..it seems
I'm
having trouble with the save method. Debugging says it is all
right...but the
save method shows in *lowercase* (i.e. mssg.save instead of
mssg.Save) ....
which sounds like an alert that something is going wrong. If I use
the SaveAs
method, instead, it shows in the *first letter capitalized*
fashion...so
what's wrong with the save method? I'm on this thing from this
morning and I
really canno tfigured out what' wrong. If run the procedure it goes
all the
way down without any error...but the message is not saved.
Here is my code:

On Error GoTo email_err

Dim objol As Object
On Error Resume Next
Set objol = GetObject("Outlook.application")
Dim msgg As Object
Dim vrtSelectedItem As Variant
With objol
Set msgg = .CreateItem(olMailItem)
End With

With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Title = "Selezionare il file di back up da inviare"
.InitialFileName = CurrentProject.Path & "\ArchivioDati\"
.Filters.Clear
.ButtonName = "Seleziona"
.Filters.ADD "zipped files", "*.zip"

If .show=-1 then
For Each vrtSelectedItem In .SelectedItems
msgg.Attachments.ADD vrtSelectedItem
Next vrtSelectedItem
msgg.To = InputBox("Indicare l'indirizzo di posta elettronica
a cui
inviare il messaggio: ", "Indirizzo em@il del destinatario")
msgg.Subject = "Invio delle tabelle del database da: " &
CurrentUser() & "; il: " & Now()
msgg.save
Dim myNameSpace As Outlook.NameSpace
Dim myDraft As Outlook.MAPIFolder
Dim myDestFolder As Outlook.MAPIFolder
Set myNameSpace = objol.GetNamespace("MAPI")
Set myDestFolder = myNameSpace.Folders(olFolderDrafts)
msgg.Move myDestFolder

Set myNameSpace = Nothing
Set myDestFolder = Nothing
Else
Set objol = Nothing
Set msgg = Nothing
Exit Sub
End If
End With

Exit Sub

email_err:
If Err.Number = 429 Then
Set objol = CreateObject("Outlook.application")
Resume Next
Else
MsgBox "La procedura ha riscontrato un errore. Controllare che:" +
vbCrLf + _
"a) sia stata fatta l'esportazione delle tabelle" + vbCrLf + _
"b) siano state zippate in un unico file .zip le tabelle esportate"
+ vbCrLf
+ _
"c) Microsoft Outlook sia installato e configurato sul proprio
sistema.",
vbCritical, "Errore nella procedura!"
Set objol = Nothing
Exit Sub
End If

Thanks!
Rocco




 




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
Send and save a message in folders anders bitzer Outlook - General Queries 9 April 20th 06 04:22 PM
After Sending Email: Save Copy of Message to Windows Folder Ben Outlook and VBA 1 March 25th 06 07:17 AM
Save Message As ZR6AJF Outlook Express 10 March 21st 06 10:13 PM
i get an error message when trying to save a contact aftershock232 Outlook - Using Contacts 3 February 26th 06 02:14 PM
Message: Could not save (appointment). Not implemented...Why? Jake Outlook - Calandaring 0 January 21st 06 02:11 PM


All times are GMT +1. The time now is 03:54 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.