‎17-06-2022 09:03 PM
Hi community.
I'm working with a macro, and trying to use megaroot in my code, but I'm receiving an error (0x80010105) and also a message that said that is needed an object. Can anyone please, bring me some examples of how to use the class oMegaroot, or megaroot, or megacurrentenvironment?
Is there any guide or technical information about it?
Thanks for your help. Regards.
Solved! Go to Solution.
‎06-10-2022 05:53 PM
Thanks for your help oguimard, very useful.
Regards.
‎06-10-2022 05:22 PM
If you are in a program that launch HOPEX from the OUTSIDE
Option Explicit
Dim hopexuserlogin
Dim hopexuserpassword
Dim adminuserlogin
Dim adminuserpassword
Dim sSandboxPassword
Dim Args
' ---- Environment, database, user, and password information ----
' --- default login and password value to open hopex ---
adminuserlogin = "Administrator"
adminuserpassword = ""
hopexuserlogin = "System"
hopexuserpassword = ""
' ---- Set Environment, database, user, and password information ----
Dim oMegaApp
Dim oEnvironment
Set oMegaApp = CreateObject("Mega.Application")
Set oEnvironment = oMegaApp.Environments.Item(1)
oEnvironment.CurrentAdministrator = adminuserlogin
oEnvironment.CurrentPassword = adminuserpassword
Dim oDatabases
Dim oDatabase
Dim MyRoot
Set oDatabases = oEnvironment.Databases
Set oDatabase = oDatabases.item("SystemDb")
Dim sConnexionString
' for a classic HOPEX User
' sConnexionString = "#Login=" & hopexuserlogin & ";Password=" & hopexuserpassword & ";Profile=HOPEX Administrator;TranType:Micro;OpenMode:W"
' for system User
sConnexionString = "#Login=" & hopexuserlogin & ";TranType=Private;TranType=Micro;OpenMode=W;SessionMode=SS;Profile=HOPEX Administrator;SystemMode=Y"
Set MyRoot = oDatabase.OpenEx(sConnexionString)
' put you code here
Dim oColLogins
Set oColLogins = MyRoot.getCollection("....")
' --- Close MEGA ---
MyRoot.MegaCommit
MyRoot.BaseClose
Set MyRoot = Nothing
' ---- Close environment ----
Set oDatabases = Nothing
Set oDatabase = Nothing
Set oEnvironment = Nothing
Set oMegaApp = Nothing
‎06-10-2022 05:16 PM
Visual Basic.
Regards
‎06-10-2022 05:08 PM
Hello,
can you specify which language you are using ?