Results 1 to 9 of 9

Thread: automation error 2147417848

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    13

    Resolved automation error 2147417848

    I has this program written in vb6, with excel object. It works fine previously. Now it has this error when it start to put in values to the excel sheet. I use excel 9.0 object lib as reference. It work when it is office97, but now I upgrade office2000 then this error.
    Any one has the same experience?
    Last edited by leemin; Oct 6th, 2004 at 12:25 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Without seeing any code it is hard to diagnose. Although, upgrading
    to Excel 2000 is probably causing the problem because the
    reference in your vb exe program is no longer correct. It is
    excpecting Excel 8.0 and Excel 9.0 has a different Class ID.
    There may be incompatibilities running a more advanced version
    as compared to an older version. If you have access to the vb
    code post it so we can really help.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    13

    automation error 2147417848

    I don't think its got anything to do with O97 or O2K. I tried uninstall O2K, delete all office keys from registry, re-install O97, it doesn't work. Next I do the same but re-install O2K, with SP3, still it doesn't work. My code is very simple, basically create an excel object, book object and sheet object. Then I begin to put in values in the cells of the worksheet. It is fine when creating these object, but its fails when it begin to put in the very first value. Here are my codes:

    Dim appexcel As Excel.Application
    Dim wSheet As Worksheet
    Dim wBook As Workbook

    Set appexcel = CreateObject("excel.application")
    appexcel.Visible = True
    appexcel.WindowState = xlMinimized
    appexcel.Workbooks.Add
    Set wSheet = appexcel.Sheets(1)
    wSheet.Select

    wSheet.Cells(1, 1).Value = "S/No"

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Just a guess but can you select a cell while its minimized? That
    may account for it failing on the first entry. Also, a tip for dimming
    your vars. just good practice to complete designate the complete
    class of object you want to dimension. Keeps vb from getting
    confused like when you use ADO and DAO both have Recordset
    objects and if you dont differentiate the two its gets wiggy.

    VB Code:
    1. Dim appExcel As Excel.Application
    2. Dim wSheet As Excel.Worksheet
    3. Dim wBook As Excel.Workbook
    Does your references only show one version of Excel (9.0 or 10.0)
    or both? Which one shows and which should it be?

    HTH


    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    13

    automation error 2147417848

    1) yes, with minimized it used to work previously. ok I tried omit that and test, still it won't work.

    2) I also tried your method ie fully qualified method (dim wsheet as excel.worksheet). It doesn't work.

    3) there is only 1 excel reference, which is excel9.olb

    This is driving me crazy. THere are quite a bit of info on this error code at msdn, but none are related to mine.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Ok, put this into a new vb project. Add reference to Microsoft Excel 9.0 Object Library.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.  
    5.     Dim appExcel As Excel.Application
    6.     Dim wSheet As Excel.Worksheet
    7.     Dim wBook As Excel.Workbook
    8.    
    9.     Set appExcel = CreateObject("excel.application")
    10.     appExcel.Visible = True
    11.     appExcel.WindowState = xlMinimized
    12.     appExcel.Workbooks.Add
    13.     Set wSheet = appExcel.Sheets(1)
    14.     wSheet.Select
    15.    
    16.     wSheet.Cells(1, 1).Value = "S/No"
    17.  
    18. End Sub
    This works for me on 2003. I just noticed that your reference is
    "excel9.olb". I dont have 2000 installed anymore but isnt it
    supposed to be "Microsoft Excel 9.0 Object Library" -
    "C:\Program Files\Microsoft Office\Office\EXCEL.EXE". Could be
    the issue. .olb = Microsoft Object Library (OLE) not the right
    reference type?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    13

    automation error 2147417848

    excel9.olb is the correct file for ms excel 9.0 object library. actually I had tried your code earlier, but nevertheless, I uninstall vb6 & reinstall vb6 with sp5 and try your code.. yet it still won't work. Next I tried a new project, but this time instead of excel I create word object and write a line of text and it works!! So the fact that I have fresh install of office2K and vb6, yet it still has this error for excel, could it be some other files or registry is corrupted? Maybe I will try with another PC or totally forget about excel automation but to use other report means probably crystal report.
    But it really sucks.. microsoft is so unstable, I mean it used to work but now it just don't work no matter what I tried.

  8. #8

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    13

    automation error 2147417848 (RESOLVED)

    ok it's confirmed!! I tried running the appl from a client PC, and the excel automation works!! Though I still don't know what's the files in my development PC that are corrupted, but at least I know the cause. The option left now for me is to re-install my OS which is win98 but I don't think I will do that - too much work.
    A very big THANK YOU to Robdog888, for all your assistant and tips along the way.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No prob. Glad to help.

    Dont forget to edit the "Original" post's subject icon to the
    resolved checkmark.


    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width