Runtime error 429: Active X component cannot create an object - vb.net

I am a newbie to vb6 and microsoft technologies. I am trying to run a vb6 application. When i open the app and try running the app, I get the following error in a dialog box "Runtime error 429: Active X component cannot create an object" and gives me two options "debug" and "end".
Environment: windows 8.1 64bit, vb6
When i click on end/debug it highlights the following code in yellow "Set m_oSNTPCtrl = CreateObject("SNTPWizard.SNTPWizardCtrl2")"..
What could be the error any missing DLL's/OCX files????
The class looks like this:
Private Sub Class_Initialize()
On Error GoTo ErrHndlr
Set m_oSNTPCtrl = CreateObject("SNTPWizard.SNTPWizardCtrl2")
m_oSNTPCtrl.UnlockSNTPWizard "SNTPWIZ-0200002100230152"
Exit Sub
ErrHndlr:
Call LogError(Err.Description, "Class_Initialize()")
End Sub

Related

VB runtime error 438 on running vbscript on Excel file

Hi I am getting VB runtime Error code 438 and on debugging it points to below code line. I'm not sure whats wrong as this is automated script that was working earlier
Private Sub ResetView() ' Resetting the view to the default.
InitGlobalCst
Application.ScreenUpdating = False
' Untoggle the "MultiSearch buttons here.
**Sheets("Views").Multi_Case.Value = False**
Sheets("Views").Multi_CR.Value = False

Error getting an instance of Rumba+ in VB --AUTOMATION ERROR INVALID SYNTAX

Microfocus placed this as an example to connect to an existing Rumba (Mainframe Emulator) instance, but it is failing at the moment I try to get the object.
Sub UseExistingRumbaSession()
Dim App As RumbaApplicationObject
Dim Emul As RumbaEmulationSessionObject
RumbaDescriptors = RunningRumbaObjectDescriptors
If Len(Join(RumbaDescriptors)) > 0 Then
Set App = GetObject(RumbaDescriptors(LBound(RumbaDescriptors)))
Set Emul = App.GetSession(App.ActiveSessionID)
End If
End Sub
I get the error in this line GetObject(RumbaDescriptors(LBound(RumbaDescriptors)))
--RUN-TIME ERROR -2147221020 (800401e4) AUTOMATION ERROR INVALID SYNTAX
I also tried to do this since that is the string it returns:
GetObject("objref:TUVPVwEAAAAAAAAAAAAAAMAAAAAAAABGgQIAAAAAAAByLuk3Pl6UH86EhdmPD2aaAyAAAPA6//+efWIggTnfNjkAIAAHAFUAUwBNAEkAVwBMAEEAUAAwADUAMAA2ADcANwAAAAcAMQA3ADIALgAyADAALgAyADcALgAyADEAMQAAAAAACQD//wAAHgD//wAAEAD//wAACgD//wAAFgD//wAAHwD//wAADgD//wAAUgD//wAAAAA=:")
Can anyone help me?

How to stop Excel Macro Which Still Runs After Application.Quit Method

I have found similar questions, but for other issues, seems that Excel is called from another application and process is left after Excel application closes.
In my case, I have a macro in my Excel file, and I try to close the application when an error occurs.
I have my error handling set this way:
'Code code code
CleanExit:
Logger.LogData LOG_DEBUG, MODULE_NAME, "Initialize", "Some module initialized!"
Exit Function
ErrorExit:
Logger.LogData LOG_ERROR, MODULE_NAME, "Initialize", "Error found! Description: " & err.description
Main.HandleError err, MODULE_NAME, "Initialize"
GoTo CleanExit
End function
I want my macro to stop running when error occurs in some module and not to stop if it's in another module (hence the GoTo CleanExit).
Error handler is set-up in this way:
Public Function HandleError(ByRef err As ErrObject, ByVal moduleOrgin As String, ByVal methodOrgin As String)
Dim wbk As Workbook
'Do something if module origin meets my parameters and exit function right here if my conditions are met
MsgBox "Some message to the user about the problem"
If GetSetting(SETTING_HIDE_APPLICATION, False) = True Then
For Each wbk In addinWorkbook.Application.Workbooks
wbk.Saved = True
Next wbk
addinWorkbook.Application.Quit
End If
End Function
After this code runs I assume that all further code running stops, as my Excel workbook, which hosts my macro code is closed with the application.
In reality I get a cascade of errors, where the error message is shown 3 times until it closes for good. How can I avoid code any code running after Application.Quit method?
Code workflow when error occurs and what runs after Application.Quit:
Main method to initialize my form
Call to loader method which throws error (Application should quit here)
Main method continues after loader method is finished
Subsequent method is called from main method which also throws an error (because first loader failed)
Lastly my main method throws an error
In total I receive 3 msgboxes with error descriptions.
I must note, that I use the same error handling procedure in all methods, but I would like the code to stop executing, so further code does not trigger any errors.
How can I avoid code any code running after Application.Quit method?
If you want to stop everything, write End after Application.Quit. It stops every piece of VBA and kills all variables you have assigned. This is not considered a good practice (At all!), but it will work exactly as you want.

Adding page to multipage

I use Excel 2016
I want to add a page to a Multi Page control.
For some reason I get the error "Run-time error '13': Type mismatch"
I have a blank Excel file with a UserForm. On the UserForm I have a CommandButton and a MultiPage, both are out of the box. I added the following code to the CommandButton
Private Sub CommandButton1_Click()
Dim myPage As Page
Set myPage = Me.MultiPage1.Pages.Add("testpage", "TestPage")
End Sub
Do I need to add references to some toolkit for this to work? For the moment I have the following references active
Visual Basic For Applications
Microsfot Excel 16.0 Object Library
OLE Automation
Microsoft Office 16.0 Object Library
Microsoft Forms 2.0 Object Library
When I write the Dim myPage declaration I get a list of objects.. I have two Page objects? Also when I write
myPage.
to get a list of available things for that object I see the following
CenterFooter
CenterHeader
LeftFooter
LeftHeader
RightFooter
RightHeader
So I assume myPage object is not from the right Page type
This works also:
MultiPage1.Pages.Add "tst1", "TestPage"
This works without getting a reference to the new Page object
Me.MultiPage1.Pages.Add
Me.MultiPage1.Pages(Me.MultiPage1.Pages.Count - 1).Name = "testpage"
Me.MultiPage1.Pages(Me.MultiPage1.Pages.Count - 1).Caption = "TestPage"
Debug.Print Me.MultiPage1.Pages(Me.MultiPage1.Pages.Count - 1).Name
Debug.Print Me.MultiPage1.Pages(Me.MultiPage1.Pages.Count - 1).Caption
The easy non code way:
Left click->New Page

Object Reference Error VB.NET

I keep getting an error:
System.NullReferenceException: Object reference not set to an instance
of an object.
Everytime I run the application outside the IDE, but for some magical reason, it works fine inside the IDE. I am definitely sure the error is caused by this code as the app ran smoothly when I removed it:
Public Function GetCommonFolder() As String
On Error GoTo ErrH
Dim winPath As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
Dim commonfolderpath As String
commonfolderpath = Replace(winPath & "\MyApp Data", "\\", "\")
If My.Computer.FileSystem.DirectoryExists(commonfolderpath) = False Then
System.IO.Directory.CreateDirectory(commonfolderpath)
End If
GetCommonFolder = commonfolderpath
Exit Function
ErrH:
GetCommonFolder = ""
Msgbox("Error retrieving common folder")
End Function
Does anyone here know what is causing this annoying problem?
It seems like the user that you run the program on outside the IDE doesn't have access to the common application data folder. Try executing it by "Run as administrator". Are you running on Windows Vista or newer? Maybe you have to require UAC elevation?