Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default RangeToHTML as plain text in Outlook

Hello-

I have used Ron De Bruins code for some time to automate the
distribution of my department statistics. The problem I face is that I
need to have the range pasted into Outlook as plain text instead of
HTML because several people receive the updates on Blackberries.
Although the Blackberries are set to receive HTML images in the
options menus, the updates still open with a blank screen and you have
to select a menu option on the Blackberry called "Get Plain Text" in
order to view the update.

Is there a way to modify The RangetoHTML code so that it pastes
inttothe Outlook message as plain "unformatted" text before sending
the email? Any help with this would be greatly appreciated.

Ron's Code:

Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2007
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook

TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-
ss") & ".htm"

'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With

'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With

'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center
x:publishsource=", _
"align=left x:publishsource=")

'Close TempWB
TempWB.Close SaveChanges:=False

'Delete the htm file we used in this function
Kill TempFile

Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default RangeToHTML as plain text in Outlook

Hi Sabosis

This function create html and use htmlbody

You can create a body message
How many cells do you want in the body of the mail

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Sabosis" wrote in message ...
Hello-

I have used Ron De Bruins code for some time to automate the
distribution of my department statistics. The problem I face is that I
need to have the range pasted into Outlook as plain text instead of
HTML because several people receive the updates on Blackberries.
Although the Blackberries are set to receive HTML images in the
options menus, the updates still open with a blank screen and you have
to select a menu option on the Blackberry called "Get Plain Text" in
order to view the update.

Is there a way to modify The RangetoHTML code so that it pastes
inttothe Outlook message as plain "unformatted" text before sending
the email? Any help with this would be greatly appreciated.

Ron's Code:

Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2007
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook

TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-
ss") & ".htm"

'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With

'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With

'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center
x:publishsource=", _
"align=left x:publishsource=")

'Close TempWB
TempWB.Close SaveChanges:=False

'Delete the htm file we used in this function
Kill TempFile

Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default RangeToHTML as plain text in Outlook

On Dec 15, 8:52*am, "Ron de Bruin" wrote:
Hi Sabosis

This function create html and use htmlbody

You can create a body message
How many cells do you want in the body of the mail

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Sabosis" wrote in ...
Hello-


I have used Ron De Bruins code for some time to automate the
distribution of my department statistics. The problem I face is that I
need to have the range pasted into Outlook as plain text instead of
HTML because several people receive the updates on Blackberries.
Although the Blackberries are set to receive HTML images in the
options menus, the updates still open with a blank screen and you have
to select a menu option on the Blackberry called "Get Plain Text" in
order to view the update.


Is there a way to modify The RangetoHTML code so that it pastes
inttothe Outlook message as plain "unformatted" text before sending
the email? Any help with this would be greatly appreciated.


Ron's Code:


Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2007
* *Dim fso As Object
* *Dim ts As Object
* *Dim TempFile As String
* *Dim TempWB As Workbook


* *TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-
ss") & ".htm"


* *'Copy the range and create a new workbook to past the data in
* *rng.Copy
* *Set TempWB = Workbooks.Add(1)
* *With TempWB.Sheets(1)
* * * *.Cells(1).PasteSpecial Paste:=8
* * * *.Cells(1).PasteSpecial xlPasteValues, , False, False
* * * *.Cells(1).PasteSpecial xlPasteFormats, , False, False
* * * *.Cells(1).Select
* * * *Application.CutCopyMode = False
* * * *On Error Resume Next
* * * *.DrawingObjects.Visible = True
* * * *.DrawingObjects.Delete
* * * *On Error GoTo 0
* *End With


* *'Publish the sheet to a htm file
* *With TempWB.PublishObjects.Add( _
* * * * SourceType:=xlSourceRange, _
* * * * Filename:=TempFile, _
* * * * Sheet:=TempWB.Sheets(1).Name, _
* * * * Source:=TempWB.Sheets(1).UsedRange.Address, _
* * * * HtmlType:=xlHtmlStatic)
* * * *.Publish (True)
* *End With


* *'Read all data from the htm file into RangetoHTML
* *Set fso = CreateObject("Scripting.FileSystemObject")
* *Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
* *RangetoHTML = ts.ReadAll
* *ts.Close
* *RangetoHTML = Replace(RangetoHTML, "align=center
x:publishsource=", _
* * * * * * * * * * * * *"align=left x:publishsource=")


* *'Close TempWB
* *TempWB.Close SaveChanges:=False


* *'Delete the htm file we used in this function
* *Kill TempFile


* *Set ts = Nothing
* *Set fso = Nothing
* *Set TempWB = Nothing
End Function- Hide quoted text -


- Show quoted text -


Ron-

It is a small amount, roughly A1:D8

Thanks for getting back to me.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default RangeToHTML as plain text in Outlook

I reply to you private

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Sabosis" wrote in message ...
On Dec 15, 8:52 am, "Ron de Bruin" wrote:
Hi Sabosis

This function create html and use htmlbody

You can create a body message
How many cells do you want in the body of the mail

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Sabosis" wrote in ...
Hello-


I have used Ron De Bruins code for some time to automate the
distribution of my department statistics. The problem I face is that I
need to have the range pasted into Outlook as plain text instead of
HTML because several people receive the updates on Blackberries.
Although the Blackberries are set to receive HTML images in the
options menus, the updates still open with a blank screen and you have
to select a menu option on the Blackberry called "Get Plain Text" in
order to view the update.


Is there a way to modify The RangetoHTML code so that it pastes
inttothe Outlook message as plain "unformatted" text before sending
the email? Any help with this would be greatly appreciated.


Ron's Code:


Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2007
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook


TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-
ss") & ".htm"


'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With


'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With


'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center
x:publishsource=", _
"align=left x:publishsource=")


'Close TempWB
TempWB.Close SaveChanges:=False


'Delete the htm file we used in this function
Kill TempFile


Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function- Hide quoted text -


- Show quoted text -


Ron-

It is a small amount, roughly A1:D8

Thanks for getting back to me.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default RangeToHTML as plain text in Outlook

Ron - how come u replied in private ;) I wanted to know the answer too.
The problem i am running into is viewing the HTML in Blackberry. I have a
Blackberry Bold 9000, HTML is enabled. I see other HTML files just fine, but
whatever i send using RangetoHTML shows up as blank page on blackberry.
Ideally, i would want to be able to view this in HTML, but that might be a
question for blackberry speacialists - i will take this up with my company
techies. As a workaround i would like to send the range as plain text, or
rich text. Is there a way to do that? Appreciate your help.

"Ron de Bruin" wrote:

I reply to you private

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Sabosis" wrote in message ...
On Dec 15, 8:52 am, "Ron de Bruin" wrote:
Hi Sabosis

This function create html and use htmlbody

You can create a body message
How many cells do you want in the body of the mail

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Sabosis" wrote in ...
Hello-


I have used Ron De Bruins code for some time to automate the
distribution of my department statistics. The problem I face is that I
need to have the range pasted into Outlook as plain text instead of
HTML because several people receive the updates on Blackberries.
Although the Blackberries are set to receive HTML images in the
options menus, the updates still open with a blank screen and you have
to select a menu option on the Blackberry called "Get Plain Text" in
order to view the update.


Is there a way to modify The RangetoHTML code so that it pastes
inttothe Outlook message as plain "unformatted" text before sending
the email? Any help with this would be greatly appreciated.


Ron's Code:


Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2007
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook


TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-
ss") & ".htm"


'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With


'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With


'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center
x:publishsource=", _
"align=left x:publishsource=")


'Close TempWB
TempWB.Close SaveChanges:=False


'Delete the htm file we used in this function
Kill TempFile


Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function- Hide quoted text -


- Show quoted text -


Ron-

It is a small amount, roughly A1:D8

Thanks for getting back to me.
.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default RangeToHTML as plain text in Outlook

My brother in law have also a Blackberry so I put it on my list of things to do and
test it on his phone. I reply when I have test it

You can set the format also in the code but I not know if this wil work


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"justas" wrote in message ...
Ron - how come u replied in private ;) I wanted to know the answer too.
The problem i am running into is viewing the HTML in Blackberry. I have a
Blackberry Bold 9000, HTML is enabled. I see other HTML files just fine, but
whatever i send using RangetoHTML shows up as blank page on blackberry.
Ideally, i would want to be able to view this in HTML, but that might be a
question for blackberry speacialists - i will take this up with my company
techies. As a workaround i would like to send the range as plain text, or
rich text. Is there a way to do that? Appreciate your help.

"Ron de Bruin" wrote:

I reply to you private

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Sabosis" wrote in message ...
On Dec 15, 8:52 am, "Ron de Bruin" wrote:
Hi Sabosis

This function create html and use htmlbody

You can create a body message
How many cells do you want in the body of the mail

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Sabosis" wrote in
...
Hello-

I have used Ron De Bruins code for some time to automate the
distribution of my department statistics. The problem I face is that I
need to have the range pasted into Outlook as plain text instead of
HTML because several people receive the updates on Blackberries.
Although the Blackberries are set to receive HTML images in the
options menus, the updates still open with a blank screen and you have
to select a menu option on the Blackberry called "Get Plain Text" in
order to view the update.

Is there a way to modify The RangetoHTML code so that it pastes
inttothe Outlook message as plain "unformatted" text before sending
the email? Any help with this would be greatly appreciated.

Ron's Code:

Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2007
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook

TempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-
ss") & ".htm"

'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
On Error Resume Next
.DrawingObjects.Visible = True
.DrawingObjects.Delete
On Error GoTo 0
End With

'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=TempFile, _
Sheet:=TempWB.Sheets(1).Name, _
Source:=TempWB.Sheets(1).UsedRange.Address, _
HtmlType:=xlHtmlStatic)
.Publish (True)
End With

'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.ReadAll
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center
x:publishsource=", _
"align=left x:publishsource=")

'Close TempWB
TempWB.Close SaveChanges:=False

'Delete the htm file we used in this function
Kill TempFile

Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function- Hide quoted text -

- Show quoted text -


Ron-

It is a small amount, roughly A1:D8

Thanks for getting back to me.
.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending mail from Outlook as plain text with VBA Tom Joseph Excel Programming 0 February 13th 09 10:50 PM
Hyperlinks in plain text? Robin Chapple[_3_] Excel Discussion (Misc queries) 1 September 5th 07 11:00 AM
Copying Data from Excel to MS Outlook in Plain Text Mode JohnGuts Excel Worksheet Functions 0 July 30th 06 09:57 PM
Hyperlink from plain text. B.C.Lioness Excel Discussion (Misc queries) 2 May 3rd 05 04:10 PM
Creating "Plain Text" mail message in Outlook from Excel VBA Shane Excel Programming 5 December 17th 03 05:10 PM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"