J
Joel
I trying to solve another posting. Can't get paste this error. Last line of
macro is giving Run Time Error 91 , Object Variable or With Block Variable
not set. I'm using excel 2003.
After the error, I can continue without any error. Itried to put On Error
Resume Next and the error still occurs.
I have created a 2 x 4 table in Outlook and saved the data to an HTML file.
I included the HTML text file. To duplicate the problem simply take the HTML
file below an copy to a notepad application and save the file as
OutlookTMP.HTML. You can double click on the file and an Internet explorer
will come up with the table.
Next run the code below changing the folder to match the directory where the
HTML file is located. I used the envirnomental path variable TEMP.
Sub test()
TempPath = Environ("Temp")
FName = TempPath & "\OutlookTMP.HTML"
Set IEObj = GetObject(FName)
Set TBL = IEObj.getelementsbytagname("Table")
'find Net and Gross
Set TBLRows = TBL.Item(0).Rows '<= Error occurs here
End Sub
Put text below in file called OutlookTMP.HTM
--------------------------------------------------------------------------------
<html>
<head>
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{colorurple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
style='border-collapse:collapse;border:none'>
<tr>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border:solid windowtext 1.0pt;
border-left:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>Net</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;
border-left:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>Gross</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;
border-left:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
</tr>
<tr>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;
border-top:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:
solid windowtext 1.0pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>5</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;
border-right:solid windowtext 1.0pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>6</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;
border-right:solid windowtext 1.0pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
</tr>
</table>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</div>
</body>
</html>
macro is giving Run Time Error 91 , Object Variable or With Block Variable
not set. I'm using excel 2003.
After the error, I can continue without any error. Itried to put On Error
Resume Next and the error still occurs.
I have created a 2 x 4 table in Outlook and saved the data to an HTML file.
I included the HTML text file. To duplicate the problem simply take the HTML
file below an copy to a notepad application and save the file as
OutlookTMP.HTML. You can double click on the file and an Internet explorer
will come up with the table.
Next run the code below changing the folder to match the directory where the
HTML file is located. I used the envirnomental path variable TEMP.
Sub test()
TempPath = Environ("Temp")
FName = TempPath & "\OutlookTMP.HTML"
Set IEObj = GetObject(FName)
Set TBL = IEObj.getelementsbytagname("Table")
'find Net and Gross
Set TBLRows = TBL.Item(0).Rows '<= Error occurs here
End Sub
Put text below in file called OutlookTMP.HTM
--------------------------------------------------------------------------------
<html>
<head>
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{colorurple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0
style='border-collapse:collapse;border:none'>
<tr>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border:solid windowtext 1.0pt;
border-left:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>Net</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;
border-left:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>Gross</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;
border-left:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
</tr>
<tr>
<td width=148 valign=top style='width:110.7pt;border:
solid windowtext 1.0pt;
border-top:none;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;border-right:
solid windowtext 1.0pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>5</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;
border-right:solid windowtext 1.0pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'>6</span></font></p>
</td>
<td width=148 valign=top style='width:110.7pt;
border-top:none;border-left:
none;border-bottom:solid windowtext 1.0pt;
border-right:solid windowtext 1.0pt;
padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</td>
</tr>
</table>
<p class=MsoNormal><font size=2 face=Arial>
<span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</div>
</body>
</html>