I'm developing an html editor using ComDlg32.ocx (Commom Dialog Control), using HTML and VBScript. My exact requirement was to prompt Open/Save/Color/Print/Font dialog boxes.Ive written code for prompting Save file dialog box. Also I've added a license file using LPK Tool onto my webpage.
My html-source looks like:
<body>
<!-- lpk file -->
<object classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<param name="LPKPath" value="License/comdlg.lpk" />
</object>
<!-- Microsoft Common Dialog Control -->
<object classid="CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb6/COMDLG32.CAB" id="objComDlg"></object>
</body>
Now, here comes my error. Whenever I try to call the vbscript for prompting the Save File dialog box, I'm getting an error as: Object doesn't support this property or method: 'objComDlg.Filter'
If I comment out the objComDlg.Filter then the error move on to objComDlg.DialogTitle and thus it goes on.
And my VBScript look like:
FILE_FORMATS = "Rich Text Format (*.rtf)|*.rtf|Microsoft Word (*.doc)|*.doc|ANSI Text Document (*.txt)|*.txt"
objComDlg.Filter = FILE_FORMATS <--- Error shows here
objComDlg.DialogTitle = "Save As "
objComDlg.Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly
objComDlg.CancelError = True
objComDlg.ShowSave
Does anyone have an idea why this is happening? Is there any proper documentation for using this particular ActiveX control? My current development is in stand-still due to this error.
BTW, I'm using Windows XP SP3 and IE8 for my development.
I have been experiencing exactly the same problem, but it only occurs on certain machines. I managed to recreate the problem with the following steps:
It would seem that the problem has occurred through an MS update. Using the KB240797 knowledge base article (http://support.microsoft.com/default.aspx/kb/240797?p=1), I was able to determine that a kill bit had been issued for the Common Dialog ActiveX control, and an alternative class ID provided (8F0F480A-4366-4737-8265-2AD6FDAC8C31), suggesting that the control had been superseded. However, after checking other machines on which the control worked, specifically development machines (XP Pro x64, XP Pro x32 & Vista x32), each with a copy of Visual Studio 2008 installed, there was no kill bit entry nor was there an alternative class ID.
To get the dialog working, I simply renamed the registry key (I could have deleted it as well), meaning that there was no longer a kill bit. Hey presto, it worked!
The registry key is:
I guess that there is a chance that this will be re-applied with a future Microsoft cumulative update, and it may also open up some security vulnerability.
I hope that that helps you. Thanks for your original post as it seems to have set me on the right track.
Kaine