Help needed...CommonDlg method

Help needed...CommonDlg method

Anonymous
Not applicable
527 Views
9 Replies
Message 1 of 10

Help needed...CommonDlg method

Anonymous
Not applicable
Hi All,

Can neone please help me with this. I am getting a type mismatch error at If .ShowOpen Then . If I give Me.cdlgMainFrm.ShowOpen as a separate line instead of giving in if ,I am getting an error that ParseFileNames method does not exist. Is ParseFileNames method a inbuilt method. Ne help with this is appreciated.

Private Sub CommandButton1_Click()
Me.cdlgMainFrm.DialogTitle = "Select Drawing files"

With cdlgMainFrm
.Filter = "AutoCAD Drawings (*.dwg)|*.dwg"
.Flags = OFN_ALLOWMULTISELECT Or OFN_EXPLORER
.MaxFileSize = 3072
If .ShowOpen Then
Files = Me.cdlgMainFrm.ParseFileNames 'I am copying the files in ParseFileNames into Files which is a Variant.
End If
End With
End Sub


Thanks
Avantika.
0 Likes
528 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Dim success as Long
success = .ShowOpen
If success > 0 Then Files = .ParseFileNames

--
R. Robert Bell


wrote in message news:5208012@discussion.autodesk.com...
Hi All,

Can neone please help me with this. I am getting a type mismatch error at
If .ShowOpen Then . If I give Me.cdlgMainFrm.ShowOpen as a separate line
instead of giving in if ,I am getting an error that ParseFileNames method
does not exist. Is ParseFileNames method a inbuilt method. Ne help with this
is appreciated.

Private Sub CommandButton1_Click()
Me.cdlgMainFrm.DialogTitle = "Select Drawing files"

With cdlgMainFrm
.Filter = "AutoCAD Drawings (*.dwg)|*.dwg"
.Flags = OFN_ALLOWMULTISELECT Or OFN_EXPLORER
.MaxFileSize = 3072
If .ShowOpen Then
Files = Me.cdlgMainFrm.ParseFileNames 'I am copying the
files in ParseFileNames into Files which is a Variant.
End If
End With
End Sub


Thanks
Avantika.
0 Likes
Message 3 of 10

Anonymous
Not applicable
Thanks Robert...But that did not help.....I am still getting that error.....
Do we need to add any headers ??? Is ParseFileNames a method provided by CommonDialogBox??? Please someone help me figure this out....
0 Likes
Message 4 of 10

Anonymous
Not applicable
That method exists in the class module I use (attached).

--
R. Robert Bell


wrote in message news:5209184@discussion.autodesk.com...
Thanks Robert...But that did not help.....I am still getting that error.....
Do we need to add any headers ??? Is ParseFileNames a method provided by
CommonDialogBox??? Please someone help me figure this out....
0 Likes
Message 5 of 10

Anonymous
Not applicable
hi Robert ,
I have both AutoCAD 2006 and 2007 full licensed version but i am not able to use common control tool, when i pick and drag common control on the user form i am getting an error msg "The Control Could not be created because it is not properly licensed. do you have a solution.
Thanks
0 Likes
Message 6 of 10

Anonymous
Not applicable
Do a search as this has been covered many times in this NG..

G'Luck

Bob Coward
0 Likes
Message 7 of 10

Anonymous
Not applicable
pge 395 of joe sutphins 2006 vba book illustrats how ths is done using
windws api.

wrote in message news:5216483@discussion.autodesk.com...
hi Robert ,
I have both AutoCAD 2006 and 2007 full licensed version but i am not able to
use common control tool, when i pick and drag common control on the user
form i am getting an error msg "The Control Could not be created because it
is not properly licensed. do you have a solution.
Thanks
0 Likes
Message 8 of 10

Anonymous
Not applicable
I must have forgotten to attach the class I mentioned in the earlier post.

BTW, you cannot use VB controls in VBA projects.

--
R. Robert Bell


wrote in message news:5216483@discussion.autodesk.com...
hi Robert ,
I have both AutoCAD 2006 and 2007 full licensed version but i am not able to
use common control tool, when i pick and drag common control on the user
form i am getting an error msg "The Control Could not be created because it
is not properly licensed. do you have a solution.
Thanks
0 Likes
Message 9 of 10

Anonymous
Not applicable
Hi

But i have another project downloaded from this website where i can directly pick common dialog from toolbar and place it on user form ,but this is not posiible for any other project ,the downloaded project does not has any class or module and has no special code for common dialog placing.
Do you have solution for this.

Benny
0 Likes
Message 10 of 10

Anonymous
Not applicable
You cannot use the VB control in a VBA project. That is why CommonDialog
classes are created for VBA. That provides the functionality of the VB
control when you are not permitted to use the control.

All you need to to to use the class is to add a reference to the class'
project file, and then use code similar to this:

Sub Test()
Dim myOpen As CommonDialogProject.CommonDialog
Set myOpen = CommonDialogProject.Init

myOpen.DialogTitle = "Select drawings"
myOpen.Filter = "Drawings (*.dwg)|*.dwg"
myOpen.Flags = OFN_ALLOWMULTISELECT + _
OFN_EXPLORER + _
OFN_FILEMUSTEXIST + _
OFN_HIDEREADONLY + _
OFN_PATHMUSTEXIST
myOpen.InitDir = "C:\datasets\CP21-2"
myOpen.MaxFileSize = 2048

Dim success As Long
success = myOpen.ShowOpen

Dim myFiles as Variant
If success > 0 Then myFiles = myOpen.ParseFileNames
End Sub


--
R. Robert Bell


wrote in message news:5217709@discussion.autodesk.com...
Hi

But i have another project downloaded from this website where i can
directly pick common dialog from toolbar and place it on user form ,but this
is not posiible for any other project ,the downloaded project does not has
any class or module and has no special code for common dialog placing.
Do you have solution for this.

Benny
0 Likes