Results 1 to 4 of 4
  1. #1
    Yaanmonkey is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2024
    Posts
    4

    Opening Embedded Spreadsheet throws error

    Hi,



    I am trying to loop through embedded spreadsheet objects (1 per row of a table) by iterating a Me.RecordsetClone, grabbing the control with the embedded spreadsheet and setting the control.Object to an Excel.WorkBook object where it can be manipulated (read) and then on to the next record.

    This used to work fine last time I used it and even worked fine when I opened it again recently but is now far from fine.

    It will run through the 1st object then throws the error "Automation Error Object is not connected to server" when it tries to assign the object on the 2nd record. Also when it runs through the 1st iteration when it gets to the "Set excelWbk = Me.oleServiceHistory.Object" command if I am stepping through with F8 idoesn;t step to the next command it just jumps all the way through the method to the breakpoint at the start of the loop again unless i put a breakpoint after the command.

    If anyone has any ideas please let me know as I am pulling out what little hair I have left.

    The code in essence is:

    Dim rst As Recordset
    Dim excelWbk As Excel.Workbook

    Set rst = Me.RecordsetClone
    rst.MoveFirst

    Do While Not rst.EOF

    Me.Bookmark = rst.Bookmark
    Debug.Print Me.ClientId


    Set excelWbk = Me.oleServiceHistory.Object

    excelWbk.Application.DisplayAlerts = False


    GetClientMachines Me.ClientId, excelWbk


    rst.MoveNext
    Loop

    And the GetClientMachines method has the signature:

    Public Sub GetClientMachines(ByVal lngClientID As Long, ByRef excelWbk As Excel.Workbook)

    What happens inside this method does not affect the behaviour described because I commented it out altogether and it does the same.


    Thanks,

    Ian

  2. #2
    Yaanmonkey is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2024
    Posts
    4
    Any help would be greatly appreciated.

    Ian

  3. #3
    Yaanmonkey is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2024
    Posts
    4
    Also, the embedded objects are displaying as: "Microsoft Excel 97-2003" and "Microsoft Excel Woorksheet" in the table with the majority being 97-2003 so I was thinking this may be a factor

  4. #4
    Yaanmonkey is offline Novice
    Windows 11 Office 365
    Join Date
    Jan 2024
    Posts
    4
    Just tested it using solely rows with "Microsoft Excel Worksheet" objects and it got to the 3rd row and same error


Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change a textbox value in before update throws error
    By twgonder in forum Programming
    Replies: 5
    Last Post: 01-02-2023, 08:14 AM
  2. Runtime Error 3075: Apostrophe Throws an Error
    By besuchanko in forum Modules
    Replies: 3
    Last Post: 03-15-2022, 05:21 PM
  3. Replies: 7
    Last Post: 05-10-2017, 11:03 PM
  4. My code throws error 424. How do i work around this?
    By ThornofSouls in forum Programming
    Replies: 2
    Last Post: 09-11-2015, 06:30 AM
  5. Replies: 2
    Last Post: 02-19-2010, 08:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums