5 Replies Latest reply: May 15, 2014 9:58 AM by Lori _ RSS

    Error at GetObject code after upgrade to XP

    paul goodwin

      After many months of happily running Windows 98 and Office 2000 using the following VB code to open Monarch from within Excel and export data into another Excel spreadsheet, we have just been upgraded to Windows XP and Office 2002 with the result that the code no longer runs.

       

      Option Explicit

      Dim MonarchObj As Object

      Dim openfile, openmod, t, exportfile As Boolean

       

      Sub Export_Data()

      Call Export_27_16_Table

      End Sub

       

      Sub Export_27_16_Table()

      Set MonarchObj = GetObject("", "Monarch32")

      If MonarchObj Is Nothing Then

      Set MonarchObj = CreateObject("Monarch32")

      End If

      t = MonarchObj.setlogfile("C:     empmonlog.log", True)

      openfile = MonarchObj.SetReportFile("M:ExcelMiscTubes clement.txt", False)

      If openfile = True Then

      openmod = MonarchObj.SetModelFile("X:appsMonarchModelsMfgPro2727.16 Aged Debtors.mod")

      End If

      exportfile = MonarchObj.JetExportTable("M:ExcelMiscSiteAged Debtors Master.xls", "Master", 0)

      MonarchObj.CloseAllDocuments

      MonarchObj.Exit

      End Sub

       

       

      At the line:-

       

      Set MonarchObj = GetObject("", "Monarch32")

       

      I get the error message:

       

      Run-time error '-2147024894 (80070002)'

      Automation error

      The system cannot find the file specified.

       

      I have had our IT department looking at it and they have tried changing permission access to the registry but without success in resolving them problem.

       

      I am running a named user network version of MonarchPro 6.01

       

      Any suggestions on what could be the cause would be most appreciated.

       

      Paul

        • Error at GetObject code after upgrade to XP
          Nick Osdale-Popa

          Unfortunately, we only run single-user editions of Monarch here, so I haven't had any experience with the network version.  However, on one of our automated computers, I tend to get automation errors.  I've yet to really track it down, cause everytime I step through the code, it runs fine.

           

          When this machine does misbehave, I run this little program,  [url="http://www.appspro.com/utilities/Cleaner.asp"]Excel VBA Code Cleaner[/url], it usually helps 9 out of 10 times in fixing the problem.  Might want to give it a try.  Read the description of why this program is available and you may find it corrects alot of other anomolies in many macros.

           

          Hope this helps!

          • Error at GetObject code after upgrade to XP
            paul goodwin

            Nick

             

            Thanks for your prompt and helpful reply.

             

            I followed the link to the Excel VBA Code Cleaner and the note to Excel 2002 XP Users immediately caught my attention.  I checked the security options checkbox "Trust Access to Visual Basic Project" within Excel 2002 and without even needing to run the cleaner my code ran perfectly.

             

            Simple but effective!    [img]smile.gif[/img]

            • Error at GetObject code after upgrade to XP
              Nick Osdale-Popa

              Hazzah!  That's great!  I'll have to keep that in mind if our shop ever decides to upgrade to XP, we're still on 97.  I'm glad it worked out for you!

              • Error at GetObject code after upgrade to XP
                Lori _

                I am having the same problem as Paul, except I have ver Monarch 7 Pro, named user network version (I am thinking this might be the problem, since the program is installed on the network drive and not my local drive).  I checked the option "Trust Access to Visual Basic Project", that didn't work.  I ran the code cleaner, that didn't work.  My code is the same as Paul, except for the location of the files.  The error is stuck at the getobject line.  Any help would be greatly appreciated.

                • Error at GetObject code after upgrade to XP
                  Lori _

                  I don't know why, but for some reason, it fixed it.  For once, you need to have Monarch open when you run the macro.  Afterwards, the macro runs fine without it.  Strange, but I can live with that.  Just in case that helps someone who has the same trouble as me.

                   

                  Originally posted by Lori:

                  I am having the same problem as Paul, except I have ver Monarch 7 Pro, named user network version (I am thinking this might be the problem, since the program is installed on the network drive and not my local drive).  I checked the option "Trust Access to Visual Basic Project", that didn't work.  I ran the code cleaner, that didn't work.  My code is the same as Paul, except for the location of the files.  The error is stuck at the getobject line.  Any help would be greatly appreciated. /b[/quote]