cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Macro GetObjectFromId Error in Script Editor

murathoca
MEGA Partner
MEGA Partner

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

6 Replies

Thank you so much. it has worked now.:-)

 

Sorry : 

Set oRoot1 = megaenv.GetRoot
Dim oSource1 : Set oSource1 = oRoot1.getObjectFromId("BB3fk0h7V992")

Thank you for your answer, but I tried it again. giving the error in the picture.

Thank you for your answer, but I tried it again. giving the error in the picture.

lionel
MEGA
MEGA

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")

murathoca
MEGA Partner
MEGA Partner

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"