DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
Go Back  Xtreme Visual Basic Talk > > > DISP_E_BADINDEX after getObject(path).Application


Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2013, 02:35 AM
timmey timmey is offline
Newcomer
 
Join Date: Apr 2013
Posts: 2
Default DISP_E_BADINDEX after getObject(path).Application


Hi,

got this program which needs to write data into an already opened excel-file

to get the object i use this code:

Code:
oXL = Excel.Application 
oWB = Excel.Workbook 
oSheet = Excel.Worksheet 

oXL = GetObject(path).Application 
oWB = oXL.Workbooks("workbook1") 
oSheet = oWB.Worksheets(name)
note: the path and name variables are commandline arguments


now the whole thing works perfectly fine but only on my workstation (and one out of 10 workstations from my clients) and since i have no access to client-workstations most of the time its hard to debug without getting any errors.

the only thing i know is that the error occurs when oXL = GetObject(path).Application gets called

therefore i then made a smaller version of the program to only test this line and it worked so i have absolutely no idea whats wrong

any ideas?

----
everybody uses office 2003 me included

Last edited by timmey; 04-19-2013 at 02:41 AM.
Reply With Quote
  #2  
Old 04-19-2013, 03:54 AM
timmey timmey is offline
Newcomer
 
Join Date: Apr 2013
Posts: 2
Default

problem solved after changing (getObject was not the problem!)

oWB = oXL.Workbooks("workbook1")
to
oWB = oXL.Workbooks("workbook1.xls")

still wondering why it worked on 2 workstations without the .xls
Reply With Quote
  #3  
Old 05-03-2013, 03:11 PM
Colin Legg's Avatar
Colin Legg Colin Legg is offline
Out Of Office

Retired Moderator
* Expert *
 
Join Date: Mar 2005
Location: London, UK
Posts: 3,402
Default

oXL.Workbooks("workbook1") would fail if the hide file extensions Windows setting isn't ticked. Best practice is to include the .xls file extension because that will work irrespective of hide file extensions setting, so your solution is the correct one.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
 
DISP_E_BADINDEX after getObject(path).Application
DISP_E_BADINDEX after getObject(path).Application
 
-->