Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
AWIcurrent AWIcurrent is offline
external usenet poster
 
Posts: 7
Default Using Word I want to create a file including graphics to use in Em

I want to create a file with graphics and pictures which can then be read in
VB 2005 and put into an email by setting the message= to the content of that
file.

Said in another way. I want to use Word to create email message content
full of pictures and so on and then save it for reading into a VB 2005
program and setting the message portion = to the file content.

This code is working great for text files. Richtext files from word are not
doing well with the pictures nor are HTML saves from WORD.

I am using system.net.mail and the message is being set as mailmsg.body= to
the content of the file read into a string variable. Should I just set the
body equal to the file rather than making it into a string variable? Body
appears to be a string type so this should work. I am setting the
mailmsg.html to true so I would think it would decode correctly...but what do
i know!

Should the body be a type other than a string? perhaps this should just be
an object but then will the mailmsg.body accept that variable type?

What is the correct way to save this from Word so that it can be used as
planned?

Thank you.


  #2   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Using Word I want to create a file including graphics to use in Em

Coincidentally I have been working with fellow MVPs to produce a macro that
does something similar. The resulting code is:

Sub Send_Extract_As_EMail()
' send the document in an Outlook Email message
' 2007 Graham Mayor, Tony Jollans, Doug Robbins
' & Sue Mosher

Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Dim objDoc As Word.Document
Dim strEMail As String

strEMail = "PR_EMAIL_ADDRESS"
'Let the user choose the contact from Outlook
'And assign the email address to a variable

strEMail = Application.GetAddress("", strEMail, _
False, 1, , , True, True)
If strEMail = "" Then
MsgBox "User cancelled or no address listed", , "Cancel"
End If

On Error Resume Next

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")

'Outlook wasn't running, start it from code
If Err 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
Set objDoc = oItem.GetInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection

With oItem
.to = strEMail
.Subject = InputBox("Subject?")
Selection.Copy
.Display
objSel.Paste
End With

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub

This will copy selected formatted text including in-line graphics and puts
them in the body of an Outlook e-mail message. For me, it only works
reliably when Outlook is already open - you can see the thread in the
microsoft.public.word.vba.general group. Formatting in Word and the message
body will be affected by the differing requirements of HTML and Word
Document format.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




AWIcurrent wrote:
I want to create a file with graphics and pictures which can then be
read in VB 2005 and put into an email by setting the message= to the
content of that file.

Said in another way. I want to use Word to create email message
content full of pictures and so on and then save it for reading into
a VB 2005 program and setting the message portion = to the file
content.

This code is working great for text files. Richtext files from word
are not doing well with the pictures nor are HTML saves from WORD.

I am using system.net.mail and the message is being set as
mailmsg.body= to the content of the file read into a string variable.
Should I just set the body equal to the file rather than making it
into a string variable? Body appears to be a string type so this
should work. I am setting the mailmsg.html to true so I would think
it would decode correctly...but what do i know!

Should the body be a type other than a string? perhaps this should
just be an object but then will the mailmsg.body accept that variable
type?

What is the correct way to save this from Word so that it can be used
as planned?

Thank you.



  #3   Report Post  
Posted to microsoft.public.word.docmanagement,microsoft.public.word.vba.general
AWIcurrent AWIcurrent is offline
external usenet poster
 
Posts: 7
Default Using Word I want to create a file including graphics to use i

Thank you for your input. I have used automation with Outlook in the past
but I am trying to move away from that.

As i have been working with this there are two issues with a saved word
document in HTML. 1. The graphic is not transfering and the email cannot
find the graphic. What one sees is the typical frame where the picture goes
with a caption name but no picture. Even with permission allowed to show the
graphic, the graphic does not show up. Logically the graphic is not in the
email so it needs a path to the graphic. But Word is not providing it.

So the first issue is to get the graphic to be available to the email when
being read.

The second issue is that non printing characters are showing up as empty
boxes in the email. Those boxes are typical of non mapped characters in a
character set. I need them to be just plain white space. So is that an
issue with the FONT I am using in the Word document or is it a problem for
the recieving email software? They sure do not show in the original being
read or worked on in Word.

The characters printing boxes are space characters I think. It could also
be a paragraph marker. Any way these have to go. This must be a common
problem.

I use Microsoft Word as my editor in Outlook for writing emails and none of
these issues are a problem in writing and sending the emails. So there must
be a solution.

"Graham Mayor" wrote:

Coincidentally I have been working with fellow MVPs to produce a macro that
does something similar. The resulting code is:

Sub Send_Extract_As_EMail()
' send the document in an Outlook Email message
' 2007 Graham Mayor, Tony Jollans, Doug Robbins
' & Sue Mosher

Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Dim objDoc As Word.Document
Dim strEMail As String

strEMail = "PR_EMAIL_ADDRESS"
'Let the user choose the contact from Outlook
'And assign the email address to a variable

strEMail = Application.GetAddress("", strEMail, _
False, 1, , , True, True)
If strEMail = "" Then
MsgBox "User cancelled or no address listed", , "Cancel"
End If

On Error Resume Next

'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outlook.Application")

'Outlook wasn't running, start it from code
If Err 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(olMailItem)
Set objDoc = oItem.GetInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection

With oItem
.to = strEMail
.Subject = InputBox("Subject?")
Selection.Copy
.Display
objSel.Paste
End With

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub

This will copy selected formatted text including in-line graphics and puts
them in the body of an Outlook e-mail message. For me, it only works
reliably when Outlook is already open - you can see the thread in the
microsoft.public.word.vba.general group. Formatting in Word and the message
body will be affected by the differing requirements of HTML and Word
Document format.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




AWIcurrent wrote:
I want to create a file with graphics and pictures which can then be
read in VB 2005 and put into an email by setting the message= to the
content of that file.

Said in another way. I want to use Word to create email message
content full of pictures and so on and then save it for reading into
a VB 2005 program and setting the message portion = to the file
content.

This code is working great for text files. Richtext files from word
are not doing well with the pictures nor are HTML saves from WORD.

I am using system.net.mail and the message is being set as
mailmsg.body= to the content of the file read into a string variable.
Should I just set the body equal to the file rather than making it
into a string variable? Body appears to be a string type so this
should work. I am setting the mailmsg.html to true so I would think
it would decode correctly...but what do i know!

Should the body be a type other than a string? perhaps this should
just be an object but then will the mailmsg.body accept that variable
type?

What is the correct way to save this from Word so that it can be used
as planned?

Thank you.




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create an email from mail merge including a hyperlink, so that the value of a merged field is included as part of the hyperlink URL, not just part of its text. [email protected] Mailmerge 0 August 17th 07 03:52 PM
Word 2003 file size and graphics Turboluis Microsoft Word Help 1 February 8th 07 11:50 PM
convert a PDF file including hyperlinks created in word Cristina Microsoft Word Help 3 October 18th 06 05:39 AM
how do I create custom labels with graphics? drpimento Page Layout 1 June 12th 05 11:02 PM
How do I create a mirror image of text and graphics for a t-shirt. mel Microsoft Word Help 2 April 21st 05 06:55 PM


All times are GMT +1. The time now is 12:25 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"