ComDlg32.ocx Error: Object doesn't support this property or method
- by abhilashca
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, Im 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.
Any help will be appreciated. Looking forward for your response.
BTW, I'm using Windows XP SP3 and IE8 for my development.
Thanks.