S
Syed Zeeshan Haider
Hello Experts,
I have Excel 97 Pro on Win98SE.
I am trying to display CommonDialog box using following code:
Dim cdbForLST As CommonDialog
Set cdbForLST = New CommonDialog
Dim ffNo As Integer
ffNo = FreeFile()
With cdbForLST
.Filter = "GetRight URL Lists (*.lst)|*.lst|All Files (*.*)|*.*"
.FilterIndex = 1
.InitDir = "C:\My Documents"
.DialogTitle = "Save as *.lst"
.ShowSave ' execution never goes beyond this point
If .FileName <> "" Then
MsgBox "OK"
' this line is for checking if execution
' reaches this point or not.
End If
End With
This code stops executing at ".ShowSave" (see comments in code) and when I
click "OK" in CommonDialog box, following error occurs:
=================================
Run-time error '20476':
Method 'ShowSave' of object 'ICommonDialog' failed
=================================
I have VB6 EE too in my computer. I have searched the help files of both,
VBA for Excel and VB6 EE, but haven't got any clue about the meaning of this
error. I have been using CommonDialog box in VB6 very successfully with same
type of code. But in VBA for Excel it is causing above mentioned error.
What is the meaning of this error?
Is newer version of CommonDialog box not compatible with VBA for Excel 97?
Thank you,
I have Excel 97 Pro on Win98SE.
I am trying to display CommonDialog box using following code:
Dim cdbForLST As CommonDialog
Set cdbForLST = New CommonDialog
Dim ffNo As Integer
ffNo = FreeFile()
With cdbForLST
.Filter = "GetRight URL Lists (*.lst)|*.lst|All Files (*.*)|*.*"
.FilterIndex = 1
.InitDir = "C:\My Documents"
.DialogTitle = "Save as *.lst"
.ShowSave ' execution never goes beyond this point
If .FileName <> "" Then
MsgBox "OK"
' this line is for checking if execution
' reaches this point or not.
End If
End With
This code stops executing at ".ShowSave" (see comments in code) and when I
click "OK" in CommonDialog box, following error occurs:
=================================
Run-time error '20476':
Method 'ShowSave' of object 'ICommonDialog' failed
=================================
I have VB6 EE too in my computer. I have searched the help files of both,
VBA for Excel and VB6 EE, but haven't got any clue about the meaning of this
error. I have been using CommonDialog box in VB6 very successfully with same
type of code. But in VBA for Excel it is causing above mentioned error.
What is the meaning of this error?
Is newer version of CommonDialog box not compatible with VBA for Excel 97?
Thank you,