943,917 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 2023
  • VB.NET RSS
Oct 7th, 2008
0

VB.NET/Outlook Message Display Issue

Expand Post »
Hello everyone, I'm new here and have a question for you! I was working on a very complex macro in VBA using Outlook 2007's macro editor, but then realized the project is more suited for a standalone executable. Feeling working on this in VB6 was too outdated, I switched over to VB.NET (on VS Express 2008), and began porting my code.

Everything seems to be working fine as 90% of the code is simple logic, not playing around with Outlook. The one problem I am having is involving code that reads HTML from a file & places it in the HTMLBody of a new Outlook message.

When using VBA code with what appears to be the exact same functionality (see below), I get different results. When I scan the HTML file's text & put it in the messages HTML body using VBA everything ends up fine (images intact, no weird formatting errors).

When I scan the same HTML file using VB.NET code & fill in the HTML body, I get strange formatting errors and a red X on each of the images telling me the following error:

"The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, then open the file again. If the red x still appears, you may have to delete the image and then insert it again."

Yet when I test the same thing again in VBA (after receiving this error), everything once again still works fine.

The HTML template I am using was exported from an OST file in Outlook, so there is some strange formatting that's not in regular HTML files. I don't know why or how this would affect the display of information though, if everything is working fine with one method.

If anyone has ANY suggestions or thoughts, please let me know! It would be greatly appreciated.

-corteplaneta
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
corteplaneta is offline Offline
6 posts
since Oct 2008
Oct 8th, 2008
0

Re: VB.NET/Outlook Message Display Issue

Yeah, I sure don't have any ideas either...I've got no idea why the formatting would be different if everything else (the HTML file, where it's loading into--HTMLBody)...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
corteplaneta is offline Offline
6 posts
since Oct 2008
Oct 9th, 2008
0

Re: VB.NET/Outlook Message Display Issue

Well can someone at least tell me a different way of reading file contents than this:
VB.NET Syntax (Toggle Plain Text)
  1. Public Function GetFileContents(ByVal FullPath As String, _
  2. Optional ByRef ErrInfo As String = "") As String
  3.  
  4. Dim strContents As String
  5. Dim objReader As StreamReader
  6. Try
  7. objReader = New StreamReader(FullPath)
  8. strContents = objReader.ReadToEnd()
  9. objReader.Close()
  10. Return strContents
  11. Catch Ex As Exception
  12. ErrInfo = Ex.Message
  13. End Try
  14. End Function
Last edited by corteplaneta; Oct 9th, 2008 at 10:06 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
corteplaneta is offline Offline
6 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Excel sheet format (column) sequence is changing
Next Thread in VB.NET Forum Timeline: Smart phone emulator





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC