Createobject Mscomdlg.commondialog Error
Contents |
Advanced Search Go to Page... Page 1 of 2 1 2 > Thread Tools Rate Thread Display Modes #1 08-08-2012, 05:52 AM rcomito Registered User mscomdlg.commondialog reference Join Date: Jul 2010 Posts: 15 Windows 7 ActiveX Problem I've been mscomdlg commondialog was not a loaded control class using SecureCRT for a couple of years on a dozen WinXP machines. I Love it. I have a couple
Vbscript Open File Dialog Windows 7
of dozen scripts that run our day to day business. Our company is migrating to Windows 7. I had the IT guys load it on test machine so I could load SecureCRT
Vbscript File Open Dialog
and the scripts and make sure everything worked. I'm receiving this error: Microsoft VBScript runtime error Error: ActiveX component can't create object: 'UserAccounts.CommonDialog' File: c:\usr\Scripts\TestScript.vbs Line: 52 Here's line 52 in context: 44 ' Create an instance of the scripting filesystem runtime so we can 45 ' manipulate files. 46 Dim fso, filesys 47 Set fso = CreateObject("Scripting.FileSystemObject") 48 Set filesys = CreateObject("Scripting.FileSystemObject") 49 50 mscomdlg.commondialog vbscript ' create an instance of the File Browser 51 Dim ObjFSO, InitFSO 52 Set ObjFSO = CreateObject("UserAccounts.CommonDialog") I'm trying to let the user select a file. We're running SecureCRT Version 7.0.0 (Build 326) I've searched Microsoft and these forums and can't find anything that seems to apply. Any ideas? Thanks - Rick rcomito View Public Profile Find all posts by rcomito #2 08-08-2012, 07:30 AM rtb VanDyke Technical Support Join Date: Aug 2008 Posts: 4,307 Hi Rick, Thanks for the question. Some capabilities available on Windows XP are no longer available on Windows 7. I would suggest that you use the SecureCRT FileOpenDialog method that has been included in the Dialog object to accomplish your goal since the UserAccounts.CommonDialog is no longer available on Windows 7. Here is an example: Code: Set fso = CreateObject("Scripting.FileSystemObject") Const ForWriting = 2 strFilename = _ crt.Dialog.FileOpenDialog("Specify Filename to Save", "Save", _ "filename.txt", "Text Files (*.txt)|*.txt||") If strFilename <> "" Then Set objFile = fso.OpenTextFile(strFilename, ForWriting, True) objFile.Write strScreenData & vbcrlf objFile.Close End If Does this help you fix your script? __________________ --Todd VanDyke Software Technical Support support@vandyke.com 505-332-5730 Last edited by rtb; 08-08-20
(עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) HomeLibraryLearnDownloadsRepositoryCommunityForumsBlog Ask a question Quick access Forums home Browse forums
Vbscript Windows 7 File Select Dialog
users FAQ Search related threads Remove From My fileopendialog Forums Answered by: Vista and vbscript: activeX component can't create object: useraccounts.commondialog'. Scripting > The Official Scripting Guys Forum! Question 0 Sign in to vote Ik am getting the following https://forums.vandyke.com/showthread.php?t=10619 error when I run a vbs script in Windows Vista:Error: activeX component can't create object: useraccounts.commondialog'. Code 800A01AD Runtime errorThe code : ' Locate a File Using a File Open Dialog Box Set objDialog = CreateObject("UserAccounts.CommonDialog") objDialog.Filter = https://social.technet.microsoft.com/Forums/scriptcenter/en-US/bd96d326-59f2-42b0-b04d-4ed65c4ce692/vista-and-vbscript-activex-component-cant-create-object-useraccountscommondialog?forum=ITCG "CBAP text bestanden|*.txt|All Files|*.*" objDialog.FilterIndex = 1 objDialog.InitialDir = "" intResult = objDialog.ShowOpen If intResult = 0 Then Wscript.Quit Else lenStr = Len(ObjDialog.FileName) For X = lenStr - 1 To 1 Step -1 If Mid(ObjDialog.FileName, X, 1) = "\" Then myAnswer = Left(ObjDialog.FileName, X) X = 0 End If Next Wscript.Echo myAnswer End If I was told to try the following:'==========================================================================' Function to create a Browse for File Dialog'=========================================================================='Example: BrowseForFile "d:","*.vbs"Function BrowseForFile(pstrPath, pstrFilter) Set objDialog = CreateObject("MSComDlg.CommonDialog") objDialog.Filter = pstrFilter objDialog.InitDir = pstrPath objDialog.MaxFileSize = 256 objDialog.Flags = &H80000 + &H4 + &H8 intResult = objDialog.ShowOpen() BrowseForFile = objDialog.FileName End Function b
here for a quick overview of the site Help Center Detailed answers to any questions you might http://stackoverflow.com/questions/4619956/vbs-script-works-on-xp-32-bit-but-not-on-7-64-bit have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 windows 7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up VBS script works on XP 32-bit but not on 7 64-bit up vote 1 down vote favorite This script (a modification of one of Rob van der Woude's) works fine on XP 32-bit, but fails on 7 64-bit createobject mscomdlg.commondialog error at Set objDialog = CreateObject( "UserAccounts.CommonDialog" ), with something similar to the error (translated from Dutch) ActiveX cannot create the object "UserAccounts.CommonDialog". Is there some different way that I have to do this for it to be compatible with Windows 7? MsgBox("Your input avi MUST be 60fps, or this script will not work."),0,"IMPORTANT!" MsgBox("Please select the location of your AVI."),0,"AVI location" WScript.Echo GetFileName( "", "AVI files (*.avi)|*.avi" ) Function GetFileName( myDir, myFilter ) Dim objDialog Set objDialog = CreateObject( "UserAccounts.CommonDialog" ) If myDir = "" Then objDialog.InitialDir = CreateObject( "WScript.Shell" ).SpecialFolders( "MyDocuments" ) Else objDialog.InitialDir = myDir End If If myFilter = "" Then objDialog.Filter = "All files|*.*" Else objDialog.Filter = myFilter End If If objDialog.ShowOpen Then GetFileName = objDialog.FileName Else GetFileName = "" End If End Function windows-7 scripting vbscript share|improve this question edited Apr 3 '12 at 21:10 Joel Coehoorn 248k92440661 asked Jan 6 '11 at 20:28 Matthieu Cartier 2182411 migrated from superuser.com Jan 6 '11 at 21:17 This qu