‎17-08-2020 12:26 PM
Hello when I execute the macro below in script editor. the macro is running. Save as Vb Macro from File Save as. When I open it again, it gives the attached error. working without saving. but when i save it gives an error getobjectfromid.
I described these in two pictures. Before Save REport is also working before saving the picture. After Save REport picture also does not work after saving and Gives Error in GetobjectFromid Line
Solved! Go to Solution.
‎24-08-2020 05:16 PM
Thank you so much. it has worked now.:-)
‎24-08-2020 04:42 PM
Sorry :
Set oRoot1 = megaenv.GetRoot
Dim oSource1 : Set oSource1 = oRoot1.getObjectFromId("BB3fk0h7V992")
‎24-08-2020 04:00 PM
‎24-08-2020 03:59 PM - edited ‎24-08-2020 04:00 PM
‎24-08-2020 03:02 PM
Hi
When your macro is not yet saved, you are in FullMegaGlobals mode, and that's why it works.
Once it's saved, your root needs to be defined.
Try this :
Set oRoot1 = GetRoot
Dim oSource1 : Set oSource1 = oRoot1.getObjectFromId("BB3fk0h7V992")
‎17-08-2020 05:05 PM
Dim oRoot1,oAnalysisPlugin1,oAnalysis1,sFile1
Dim oSource1 : Set oSource1 = getObjectFromId("BB3fk0h7V992")
Set oRoot1 = GetRoot
Set oAnalysisPlugin1 = oRoot1.CurrentEnvironment.GetMacro("~9MuFp4qmBD40[Analysis Plugin]")
Set oAnalysis1 = oAnalysisPlugin1.newAnalysisFromMegaInstance(oSource1,false)
oAnalysis1.setDestinationFile "C:\ENVIRONMENT\Archimate\Training\intranet\refext\Top 10 most expensive applications.xls"
oAnalysis1.setForceRefresh(True)
sFile1 = oAnalysis1.Generate("XLS",MySelf,Nothing)
print "OK"