Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Excel > Excel Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-10-2012, 07:43 AM
tinfanide tinfanide is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2011
Posts: 308
tinfanide is on a distinguished road
Default Run-time error '91': Object variable or With block variable not set

app.xlsm



It is a long set of codes. If you have time, please help look at it.
The error is

Run-time error '91':
Object variable or With block variable not set

When I select Cells A7 and A8,
run Sub Sheet1.t2.
The error will occur.

I have commented where I guess (just I guess) the error comes from
as
when I deleted the code
Code:
Set oIE = s
The error does not come out
but
it cannot function as expected (use the newly opened tab)
My intention was to open a new tab in IE
and
use the new tab

I have worked on it for many hours.
So if you can help test the codes, I would be grateful for your help.
Many thanks in advance.
Reply With Quote
  #2  
Old 06-10-2012, 09:11 AM
tinfanide tinfanide is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2011
Posts: 308
tinfanide is on a distinguished road
Default

app1.xlsm

Edited.
You can see the change in the comment blocks.
Still an error coming out.
Reply With Quote
  #3  
Old 06-10-2012, 10:17 AM
tinfanide tinfanide is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2011
Posts: 308
tinfanide is on a distinguished road
Default

app2.xlsm

The resolution, to my amazement, is desperate.
By adding
Code:
Application.Wait DateAdd("s", 1, Now)
before each time
Code:
oIE.Navigate "URL"
The error does not emerge.

Very long time age I discovered the "trick" of it, but
I hate using it as I dunno... anyway just thought it was not a proper way to tackle run-time errors. Whenever I couldn't explain why the error exists and find the right way to resolve it, just using a hard way... is not going to help me improve my scripting knowledge a lot.
Anyway, don't know what I'm talking about. If anyone knows why the run-time error exists, please do teach me a thing. Thank you in advance.

P.S.:
Indeed, the error normally emerges 3 - 4 times out of 10 trials.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
variable Page references scrinmemphis Word 4 06-06-2012 11:50 PM
XML parsing & Object variable not set (Error 91) tinfanide Excel Programming 0 12-29-2011 08:43 AM
Multi-Variable Lookup help ebolton Excel 8 05-05-2011 05:28 AM
Variable fields? Emalee77 PowerPoint 0 01-30-2011 05:58 PM
Variable Table_Array in VLOOKUP pdab09 Excel 3 11-23-2010 05:28 AM


All times are GMT -7. The time now is 05:10 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft