×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Object Error

Object Error

Object Error

(OP)
Hello!

I am trying to extract data from an Excel document through to my EXTRA! X-treme application (to put in an array and run through a loop).

I currently have the code:

CODE -->

Dim obj as object
        Dim objWorkbook as object
        Set obj = CreateObject("Excel.Application")
        obj.visible = True
        obj.workbooks.open "F:\actuarial\Shared\Product_Support\ALBA\Incident_1840\Testing.xls" 
        obj.WorkSheets("Testing").Cells(15,"A").Value = 10 

Which I have effectively copied from other posts on this forum.

My code opens Excel and the desired file correctly however fails on the final line due to an "Object Error". The Excel document only has 1 tab named "Testing". The only thing I can think of is that my EXTRA! X-treme application is opened via a remote desktop.

Any help would be greatly appreciated!

Thank you,

Marc

RE: Object Error

Hi,

Make sure that your sheet name has no trailing or leading SPACES by Editing the Sheet Tab.

If you are using Excel in any manner in your process, I would recommend coding your entire process in Excel VBA. I can remember coding in Extra VB once, and being frustrated by the unsophisticated editor. Consequently, I’ve coded all my Attachmate screen scraping in Excel, as the tools in Excel VBA are much more sophisticated than Extra VB.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Object Error

(OP)
Hi Skip,

I have tried the above and the sheet name is exactly the same, to the point of copying it over!

Unfortunately I cannot code my process in Excel VBA as the program, EXTRA! X-treme is opened via a remote desktop. For example, we run an application which opens a temporary remote desktop, it opens EXTRA! X-treme as an application. (This is also done on a remote desktop, very confusing I know)

Could this perhaps be the reason why I am struggling to interact between the two?

I have tried a few different things but it seems that as soon as I have the excel document open I cannot interact with it, including just the simple line

CODE -->

set x = obj.ActiveSheet 

I do notice that when the excel document is open it cascades with the remote EXTRA! X-treme session (the remote desktop used to open EXTRA), please see the attachment...

https://files.engineering.com/getfile.aspx?folder=...

Thank you,

Marc

RE: Object Error

I'm not sure how EXTRA! X-treme is different than plain vanilla Extra, but my experience coding in Extra VB--I was spoiled from coding in Excel VBA. The difference was night and day! The difference was like going from a fine luxury car to a Yugo.

Your Remote Desktop should make no difference. But I'd be a bit more careful with Excel objects by setting object for workbook...

CODE

'
    Dim oXL As Object
    Dim oWB As Object
    
    'instantiate the oXL Excel Application object
    Set oXL = CreateObject("Excel.Application")
    oXL.Visible = True
    
    'instantiate the oWB Excel Workbook object
    Set oWB = oXL.Workbooks.Open("F:\actuarial\Shared\Product_Support\ALBA\Incident_1840\Testing.xls")
    
    oWB.Worksheets("Testing").Cells(15, "A").Value = 10 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Object Error

Using a mapped drive (F: in your code) can be a problem. I’d use the Server logical name instead...

CODE

Set oWB = oXL.Workbooks.Open("\\YourServerName\actuarial\Shared\Product_Support\ALBA\Incident_1840\Testing.xls") 

NOTE: your server may also include a subserer name as well like \\Server\subserver...

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Object Error

(OP)
Hi Skip,

I have tried the above with the code:

CODE -->

Dim oXL As Object
    Dim oWB As Object
    
    'instantiate the oXL Excel Application object
    Set oXL = CreateObject("Excel.Application")
    oXL.Visible = True
    
    'instantiate the oWB Excel Workbook object
    Set oWB = oXL.Workbooks.Open("\\co004\Public\actuarial\Shared\Product_Support\ALBA\Incident_1840\Testing.xls")
    
    oWB.Worksheets("Testing").Cells(15, "A").Value = 10 

Yet we are still falling at the same hurdle :(.

I am pretty certain I have used the correct name and have attached the server mapping for reference.

Thanks,

Marc

RE: Object Error

Can you try putting it in a local folder and see if it will open in a simple path. Also I would not use the // as I believe it indicates something is behind the // yet not included in the path. Looking at your last snip, I would start the path with "F:\Public...."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close