Createobject Useraccounts.commondialog Error
Contents |
finally retired my Windows XP-based Dell Latitude D620 from active work duty. I had been holding out for a business laptop with USB 3.0 to become available on
Vbscript Open File Dialog Windows 7
the internal procurement site, and were finally able to obtain a vbscript browse for file windows 7 Lenovo X230 with an Ivy Bridge i5-3320M processor. (Un)fortunately this new machine is running Windows 7 x64, and
Vbscript Filedialog
for that matter a bastardized version full of all the resource hungry corporate mandated bloat. This is the first time I have seen/used Windows 7 (having managed to also vbscript open file dialog box windows 7 completely avoid Vista). The first thing I find myself doing is trying to make Windows 7 feel and behave like Windows XP again. After installing classic shell to get the old start button functionality back (http://classicshell.sourceforge.net/) and turning off all of the visual effects (aka - ‘Adjust for best performance' setting), my desktop is starting to resemble and feel objshell.browseforfolder to select file like the ugly but reliable XP again. Now I'm slowly working through my kit bag of productivity scripts that I created for XP and trying to get these to function in Windows 7. One of the more frequent scripts I leverage is a simple VBScript for upload and download of a file by invoking the command-line FTP utility shipped with Windows. See the following article I wrote for the full original XP supported source code: http://todayguesswhat.blogspot.com.au/2010/06/vbscript-ftp-upload-sample-leverages.html I found out that the UserAccounts.CommonDialog class/control is not available in Windows 7. I leveraged this control to allow the user to select a file for upload. Original VBScript code shown below: Function ChooseFile(initialDir) Set cd = CreateObject("UserAccounts.CommonDialog") cd.InitialDir = initialDir cd.Filter = "ZIP files|*.zip|Text Documents|*.txt|Shell Scripts|*.*sh|All Files|*.*" ' filter index 4 would show all files by default ' filter index 1 would should zip files by default cd.FilterIndex = 1 If cd.ShowOpen = True Then ChooseFile = cd.FileName Else ChooseFile = "" End If Set
Advanced Search Go to Page... Page 1 of 2 1 2 > Thread Tools Rate Thread Display Modes #1
Vbscript Browseforfolder
08-08-2012, 05:52 AM rcomito Registered User Join Date: Jul 2010 Posts: fileopendialog 15 Windows 7 ActiveX Problem I've been using SecureCRT for a couple of years on a dozen WinXP
Browseforfile
machines. I Love it. I have a couple of dozen scripts that run our day to day business. Our company is migrating to Windows 7. I had the IT guys http://todayguesswhat.blogspot.com/2012/08/windows-7-replacement-for.html load it on test machine so I could load SecureCRT 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. https://forums.vandyke.com/showthread.php?t=10619 46 Dim fso, filesys 47 Set fso = CreateObject("Scripting.FileSystemObject") 48 Set filesys = CreateObject("Scripting.FileSystemObject") 49 50 ' 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 Se
This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. All Places > PCB Systems Design > Xpedition Enterprise > Automation and Scripting > Discussions Please enter https://communities.mentor.com/thread/11587 a title. You can not post a blank message. Please type your message and try again. 7 Replies Latest reply on Apr 13, 2013 1:57 AM by http://www.xtremevbtalk.com/web-programming/324448-file-dialog-box-windows-7-code-broke.html Patrick.Cashman How to display a file selecting dialog on Windows7 olsmir Apr 1, 2013 11:45 PM Hello All.On WindowsXP, when I need to display a file selecting dialog, windows 7 I use the following object: Set objDialog = CreateObject("UserAccounts.CommonDialog").On Windows7, this doesn't work.I would like to hear from Windows7 users: what object do they use when they need to display a file selecting dialog?Oleg 32872Views Tags: none (add) This content has been marked as final. Show 7 replies 1. Re: How to display a file vbscript open file selecting dialog on Windows7 Satoru Apr 2, 2013 12:04 AM (in response to olsmir) Hi Oleg-san,UserAccounts.CommonDialog can't be used on Windows7.There is a type which uses an InternetExplorer object.Regards,Satoru OpenFileDialog.zip 1.4 KB 1 of 1 people found this helpful Like Show 0 Likes(0) Actions 2. Re: How to display a file selecting dialog on Windows7 olsmir Apr 2, 2013 2:41 AM (in response to Satoru) Hi Satoru,Thank you for this method. But comparing with the UserAccounts.CommonDialog method, your method is rather cumbersome construction. It requires a lot of excessive statements.I expected some approach built in Windows 7.However, it does work.Oleg Like Show 0 Likes(0) Actions 3. Re: How to display a file selecting dialog on Windows7 Satoru Apr 4, 2013 3:41 AM (in response to olsmir) Hi Oleg-san,If it is a type which uses Excel, there is also a little easy construction.All the samples which work on Win7 which I have are sent.The method of using "MSComDlg.CommonDialog" works on a 32-bit command pr
Get Open File Dialog Box in Windows 7...old code broke Thread Tools Display Modes #1 07-19-2012, 12:24 PM VBAguy Centurion Join Date: Feb 2005 Location: Kentucky (USA) Posts: 186 Get Open File Dialog Box in Windows 7...old code broke I wrote this code a while back and it's been working beautifully until I switched to Windows 7. This is just part of the code but it's the part that's broken right now and I'm getting an error message. I need to present an open file dialog box and allow the user to select the appropriate Excel file. Here's the current code: Code: Sub Open_File_Dialog Dim objDialog, intResult 'Displays an open file dialog box and opens file selected Set objDialog = CreateObject("UserAccounts.CommonDialog") objDialog.Filter = "Excel Files (.xls)|*.xls" objDialog.FilterIndex = 1 objDialog.InitialDir = "H:\Account Detail\" intResult = objDialog.ShowOpen If intResult = 0 Then Dim msg msg = "Must Select a File" MsgBox msg, vbinformation + vbcritical Set objDialog = Nothing Wscript.Quit Else ExcelFile = objDialog.FileName End If Set objDialog = Nothing End Sub I'm getting an error message on this line: Code: Set objDialog = CreateObject("UserAccounts.CommonDialog") How would I update this to do the same thing in Windows 7? Thanks so much for the help. It's been a while since I've done this stuff so I'm not up to date at all. __________________ There are some things that we will never know And we will never know that we don't know them. VBAguy View Public Profile Find all posts by VBAguy #2 07-20-2012, 07:14 AM DrPunk Senior Contributor * Expert * Join Date: Apr 2003 Location: Never where I want to be Posts: 1,403 http://social.technet.microsoft.com/...d-4ed65c4ce692 __________________ There are no computers in heaven! DrPunk View Public Profile