PC Review


Reply
Thread Tools Rate Thread

Outlook dropping an image

 
 
Nick Ward
Guest
Posts: n/a
 
      18th Apr 2004
Hi
I have a function that generates a customer quotation in MS Word. It also
inserts a picture of my choosing into a bookmark in the word template:

If Not IsNull(Forms!frm_quote![SuggestedImage]) Then
m_objWord.ActiveDocument.Bookmarks("picy").Select
m_objWord.Selection.InlineShapes.AddPicture FileName:= _
recSupps("suggestedImage") _
, LinkToFile:=False, SaveWithDocument:=True
End If

This all work swimmingly well except that I have encountered a problem when
I have some code that generates a quote and then attaches it to an email.
Its attaching the word doc without the image! so I get the quote generated
missing the jpg.

Was wondering if anyone has come across this before as its really annoying
as I have to manually attach the quote to the email to get over this problem

strOrder = "Dear " & recSupps("Salutation") & _
vbCrLf & vbCrLf & _
"Many thanks for your enquiry please find your quote attached
to this email." & _
vbCrLf & vbCrLf & _
"Kind Regards" & _
vbCrLf & vbCrLf & _
"Nick Ward"

If Not IsNull(recSupps("Email")) Then
Set objMessage = objOutlook.CreateItem(olMailItem)
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myItems = myInbox.Items
Set mydestfolder = myInbox.Folders("quotes to be sent")

With objMessage

.BodyFormat = olFormatRichText
.Importance = olImportanceHigh
.To = recSupps("Email")
.Subject = "Requested Quote"
.Body = strOrder
.Attachments.Add M_strDIRSave & m_objDoc
.Save
.Move mydestfolder
End With
End If
m_objDoc.Close
m_objWord.Quit
Set m_objDoc = Nothing
Set m_objWord = Nothing
requerynotesform


 
Reply With Quote
 
 
 
 
Nick Ward
Guest
Posts: n/a
 
      18th Apr 2004
Problem Solved....
If you close the word object first and then attach it , it works ok

so
dim myattach as string
myattach = m_objdoc

m_objDoc.Close
m_objWord.Quit
Set m_objDoc = Nothing
Set m_objWord = Nothing

.BodyFormat = olFormatRichText
.Importance = olImportanceHigh
.To = recSupps("Email")
.Subject = "Requested Quote"
.Body = strOrder
.Attachments.Add M_strDIRSave & myattach
.Save
.Move mydestfolder



"Nick Ward" <(E-Mail Removed)> wrote in message
news:40824dd2@212.67.96.135...
> Hi
> I have a function that generates a customer quotation in MS Word. It also
> inserts a picture of my choosing into a bookmark in the word template:
>
> If Not IsNull(Forms!frm_quote![SuggestedImage]) Then
> m_objWord.ActiveDocument.Bookmarks("picy").Select
> m_objWord.Selection.InlineShapes.AddPicture FileName:= _
> recSupps("suggestedImage") _
> , LinkToFile:=False, SaveWithDocument:=True
> End If
>
> This all work swimmingly well except that I have encountered a problem

when
> I have some code that generates a quote and then attaches it to an email.
> Its attaching the word doc without the image! so I get the quote generated
> missing the jpg.
>
> Was wondering if anyone has come across this before as its really annoying
> as I have to manually attach the quote to the email to get over this

problem
>
> strOrder = "Dear " & recSupps("Salutation") & _
> vbCrLf & vbCrLf & _
> "Many thanks for your enquiry please find your quote attached
> to this email." & _
> vbCrLf & vbCrLf & _
> "Kind Regards" & _
> vbCrLf & vbCrLf & _
> "Nick Ward"
>
> If Not IsNull(recSupps("Email")) Then
> Set objMessage = objOutlook.CreateItem(olMailItem)
> Set myOlApp = CreateObject("Outlook.Application")
> Set myNameSpace = myOlApp.GetNamespace("MAPI")
> Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
> Set myItems = myInbox.Items
> Set mydestfolder = myInbox.Folders("quotes to be sent")
>
> With objMessage
>
> .BodyFormat = olFormatRichText
> .Importance = olImportanceHigh
> .To = recSupps("Email")
> .Subject = "Requested Quote"
> .Body = strOrder
> .Attachments.Add M_strDIRSave & m_objDoc
> .Save
> .Move mydestfolder
> End With
> End If
> m_objDoc.Close
> m_objWord.Quit
> Set m_objDoc = Nothing
> Set m_objWord = Nothing
> requerynotesform
>
>



 
Reply With Quote
 
Larry Linson
Guest
Posts: n/a
 
      19th Apr 2004
I'm glad you found the answer. But, wouldn't a newsgroup dedicated to either
Outlook or Word have been a better place to ask than one dedicated to
Microsoft Access database questions and answers?

Larry Linson
Microsoft Access MVP

"Nick Ward" <(E-Mail Removed)> wrote in message
news:40825831@212.67.96.135...
> Problem Solved....
> If you close the word object first and then attach it , it works ok
>
> so
> dim myattach as string
> myattach = m_objdoc
>
> m_objDoc.Close
> m_objWord.Quit
> Set m_objDoc = Nothing
> Set m_objWord = Nothing
>
> .BodyFormat = olFormatRichText
> .Importance = olImportanceHigh
> .To = recSupps("Email")
> .Subject = "Requested Quote"
> .Body = strOrder
> .Attachments.Add M_strDIRSave & myattach
> .Save
> .Move mydestfolder
>
>
>
> "Nick Ward" <(E-Mail Removed)> wrote in message
> news:40824dd2@212.67.96.135...
> > Hi
> > I have a function that generates a customer quotation in MS Word. It

also
> > inserts a picture of my choosing into a bookmark in the word template:
> >
> > If Not IsNull(Forms!frm_quote![SuggestedImage]) Then
> > m_objWord.ActiveDocument.Bookmarks("picy").Select
> > m_objWord.Selection.InlineShapes.AddPicture FileName:= _
> > recSupps("suggestedImage") _
> > , LinkToFile:=False, SaveWithDocument:=True
> > End If
> >
> > This all work swimmingly well except that I have encountered a problem

> when
> > I have some code that generates a quote and then attaches it to an

email.
> > Its attaching the word doc without the image! so I get the quote

generated
> > missing the jpg.
> >
> > Was wondering if anyone has come across this before as its really

annoying
> > as I have to manually attach the quote to the email to get over this

> problem
> >
> > strOrder = "Dear " & recSupps("Salutation") & _
> > vbCrLf & vbCrLf & _
> > "Many thanks for your enquiry please find your quote

attached
> > to this email." & _
> > vbCrLf & vbCrLf & _
> > "Kind Regards" & _
> > vbCrLf & vbCrLf & _
> > "Nick Ward"
> >
> > If Not IsNull(recSupps("Email")) Then
> > Set objMessage = objOutlook.CreateItem(olMailItem)
> > Set myOlApp = CreateObject("Outlook.Application")
> > Set myNameSpace = myOlApp.GetNamespace("MAPI")
> > Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
> > Set myItems = myInbox.Items
> > Set mydestfolder = myInbox.Folders("quotes to be sent")
> >
> > With objMessage
> >
> > .BodyFormat = olFormatRichText
> > .Importance = olImportanceHigh
> > .To = recSupps("Email")
> > .Subject = "Requested Quote"
> > .Body = strOrder
> > .Attachments.Add M_strDIRSave & m_objDoc
> > .Save
> > .Move mydestfolder
> > End With
> > End If
> > m_objDoc.Close
> > m_objWord.Quit
> > Set m_objDoc = Nothing
> > Set m_objWord = Nothing
> > requerynotesform
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Outlook dropping connection Roady [MVP] Microsoft Outlook Discussion 0 21st Dec 2006 04:13 PM
Outlook Dropping Connection Microsoft.com Newsboards Microsoft Outlook 2 25th May 2005 11:49 PM
outlook dropping attachments dlp Microsoft Outlook 1 21st Dec 2004 04:46 AM
Outlook dropping offline Gwen Microsoft Outlook 0 6th Jul 2004 08:29 PM
Outlook Dropping when using VPN Mike Microsoft Windows 2000 RAS Routing 0 14th Oct 2003 09:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:23 PM.