locked
Cannot create ActiveX component

    Question

  • I've converted an app from vb6 to vb2008. It works on XP and

    Windows 7. On Vista, I get this error: System.Exception was unhandled Message="Cannot create ActiveX component." at this line: fso = CreateObject("Scripting.FileSystemObject") in this code: Public Sub LoadStory(ByRef Story As String, ByRef Bookmark As Short, ByRef bReadFromClipboard As Boolean) Const ForReading As Short = 1 Dim fso, file As Object EndOfText = False StoryNamePB = Story StartPos = 1 If bReadFromClipboard = False Then fso = CreateObject("Scripting.FileSystemObject") file = fso.OpenTextFile(StoryNamePB, ForReading) StoryBuffer = file.ReadAll file.Close() If Bookmark > 0 Then StoryBuffer = Mid(StoryBuffer, Bookmark) End If Else StoryBuffer = Story End If StoryLen = Len(StoryBuffer) End Sub This is the error detail: System.Exception was unhandled Message="Cannot create ActiveX component." Source="Microsoft.VisualBasic" StackTrace: at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName) at Readline.ParserPlus.LoadStory(String& Story, Int16& Bookmark, Boolean& bReadFromClipboard) in C:\Readline.NET\Parser.vb:line 27 at Readline.frmSentenceScramble.Form_Load(Object eventSender, EventArgs eventArgs) in C:\Readline.NET\frmSentenceScramble.vb:line 123 at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow) at System.Windows.Forms.Control.SetVisibleCore(Boolean value) at System.Windows.Forms.Form.SetVisibleCore(Boolean value) at System.Windows.Forms.Control.Show() at Readline.frmReadOnMe.cmdStartReading_Click(Object eventSender, EventArgs eventArgs) in C:\Readline.NET\frmReadOnMe.vb:line 763 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.PerformClick() at Readline.frmReadOnMe.cmdStartSentenceScramble_Click(Object sender, EventArgs e) in C:\Readline.NET\frmReadOnMe.vb:line 2245 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Readline.frmReadOnMe.Main() in C:\Readline.NET\frmReadOnMe.designer.vb:line 1 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) at System.Activator.CreateInstance(ActivationContext activationContext) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: *****Also, It might be worth mentioning, that I get an error on the

    same line when i try to run the vb6 version on Vista.

    The message given: Run-time Error 2147024770 (8007007e) Automation

    error - module could not be found


    Thursday, November 08, 2012 8:03 PM

All replies

  • Hi LaptopGoddess,

    Thanks for you post.

    Please have a look in registry for Scripting.FileSystemObject under HKCR.

    If you can not find this PROGID then you may need to re-registering scrrun.dll (path: C:\windows\system32\scrrun.dll) with regsvr32.

    For more information, please check: http://xsisupport.com/2011/10/20/activex-component-cant-create-object-scripting-filesystemobject/

    Have a try.



    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 09, 2012 8:13 AM
    Moderator
  • Hi Mark,

        Thanks so much for your help with this.  Since I'm a traumatic brain injury specialist and not a programmer, sometimes I have difficulty with instructions.  I looked up how to register a dll using regsvr32 and followed the instructions.  Start> Searched - "cmd" > entered.  Then I typed regsvr3 scrrun.dll 

    The error message I got back was:

    Regsvr32

    The  module "scrrun.dll" failed to load. 

    Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependant DLL file

    What am I doing wrong? 

    Friday, November 09, 2012 2:19 PM
  • Hi Again Mark,

        I found instructions that were complete and specific for Vista.  I clicked start > Run and typed regsvr32\"C\Windows\Systems32\scrrun.dll" and I got an error again - Make sure you typed it correctly and try again.

    When I do a search, scrrun.dll is in fact located in the path above.  When I tried to browse for it during the process, it is not listed.  What is the meaning of this and how can it be corrected?

    Also, the Scripting.FileSystemObject is in the registry.


    Friday, November 09, 2012 3:40 PM
  • Hi LaptopGoddess,

    >>When I tried to browse for it during the process, it is not listed.  What is the meaning of this and how can it be corrected?

    So can I got the meaning that you do not find the scrrun.dll in that folder? Please check it carefully, because it will not be missing.

    Also the command typing is wrong, need to be “regsvr32 C\Windows\Systems32\scrrun.dll

    If you use 64bit version of Vista, please try this way to registery the dll.

    1. Open the Syswow64 folder under the %SystemRoot% (such as “C:\Windows\SysWOW64”)

    2. Find the cmd.exe and right click it to run as administrator

    3. Type in “regsvr32 C\Windows\Systems32\scrrun.dll

    Have a try.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Monday, November 12, 2012 3:00 AM
    Moderator
  • I retyped it exactly as aboveand tried again.  I got the same error.  It can't find scrrun.dll at C\windows\Systems32\scrrun.dll and it is right there.  I can easily find it.  Why is that? 

    Monday, November 12, 2012 5:32 PM
  • Hi LaptopGoddess,

    What the command line you used?

    Pay attention that there is no any “”(Double quotes) in here.

    Also the path needs to be “C:\Windows\Systems32\scrrun.dll” (don’t forget the “:”)

    I look forward your reply.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, November 13, 2012 3:01 AM
    Moderator
  • Hi Mark,

    Progress!  I'm getting a new error now!  C:Windows\System32 refers to a location that is not available.  How can I resolve this new issue?

    Wednesday, November 14, 2012 12:25 AM
  • Hi LaptopGoddess,

    As I mentioned before, you need to find the cmd.exe and right click it to run as administrator.

    Hope this can get rid of this issue.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 14, 2012 2:02 AM
    Moderator
  • Mark,

    What cmd.exe?  I really don't know what you mean by that.  How do I find the cmd.exe?

    Wednesday, November 14, 2012 4:06 PM
  • Hi LaptopGoddess,

    When you press the "cmd" in searchbox, you will find there is a cmd.exe in the menu. Right click it and to run it as administrator.

    If you are using 64bit OS, try the steps in my second reply.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 15, 2012 2:15 AM
    Moderator
  • Hi Again,

        I followed your directions and at C:\Windows\System32>  I typed

    regsvr32\C:\Windows\System32\scrrun.dll 

    which gave me a response of: The filename, directory name, or volume label syntax is incorrect.

    Then I tried again and after C:\Windows\System32>  I typed

    C:\Windows\System32\scrrun.dll

    which gave me an error: This file does not have a program associated with it for performing this action.  Create an association in the Set Association control panel.

    What am I doing wrong?

    Friday, November 16, 2012 3:39 PM
  • Hi Mark,

    I followed ur steps and got a message succeeded. 

    still am getting the same error message "Cannot create ActiveX component."

    Thursday, November 22, 2012 10:05 AM