Common Dialog Control?

Common Dialog Control?

Anonymous
Not applicable
193 Views
5 Replies
Message 1 of 6

Common Dialog Control?

Anonymous
Not applicable
Would anyone possibly have a snippet of code
showing how to use the Microsoft Common Dialog Control to add a selected list of
drawing filenames to an array or to a grid.... I would like to select more than
one file at a time from a folder and add them to a MSFlexgrid in order to batch
process them...

 

Thanks in advance...


--
Rodney D. Lester
Systems
Manager
GMS, Inc.
0 Likes
194 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Any Ideas why this doesn't work?

Public Sub g_sb_ReadData()

Dim lo_DlgCtrl As CommonDialog
Dim ls_FileName As String

Set lo_DlgCtrl = New CommonDialog

lo_DlgCtrl.Filter = "Text Files (*.txt)|*.txt"

lo_DlgCtrl.ShowOpen

ls_FileName = lo_DlgCtrl.FileName

MsgBox ls_FileName

Set lo_DlgCtrl = Nothing

End Sub

The error occurs right after the user selects the file and closes the dialog
box .

--
Best Regards,

D. M. Levesque
0 Likes
Message 3 of 6

Anonymous
Not applicable
D.M.

The command dialog control will raise an error
(Err.num 32755) when the operation is cancelled
(if the CancelError property is set to True)

Denis
0 Likes
Message 4 of 6

Anonymous
Not applicable
What environment are you using this in? Do you have any more details?

Joe

D. M. Levesque wrote in message
news:8949tv$otc3@adesknews2.autodesk.com...
> Any Ideas why this doesn't work?
>
> Public Sub g_sb_ReadData()
>
> Dim lo_DlgCtrl As CommonDialog
> Dim ls_FileName As String
>
> Set lo_DlgCtrl = New CommonDialog
>
> lo_DlgCtrl.Filter = "Text Files (*.txt)|*.txt"
>
> lo_DlgCtrl.ShowOpen
>
> ls_FileName = lo_DlgCtrl.FileName
>
> MsgBox ls_FileName
>
> Set lo_DlgCtrl = Nothing
>
> End Sub
>
> The error occurs right after the user selects the file and closes the
dialog
> box .
>
> --
> Best Regards,
>
> D. M. Levesque
>
>
0 Likes
Message 5 of 6

Anonymous
Not applicable
Hello,

I have a program that uses this function. It works fine on my computer
but gives an error on everyone elses. The error is "Run-time error 429:
activex component can't create object". I've highlighted where the
program stops when I debug

Private Function GetPbzFile() As TextStream
'dimension locals
Dim dlgSaveFile As New CommonDialog
Dim strPbzFileName As String
Dim fsoPbzFile As New FileSystemObject
Dim txsPbzText As TextStream

'set the common save file dialog properties
****************dlgSaveFile.DialogTitle = "Export PBZ
File"*******************stops here
dlgSaveFile.DefaultExt = ".pbz"
dlgSaveFile.Filter = "Handtman (Pbz) File|*.Pbz"

'open the common save file dialog & display the file name
'in the textbox (txtFileName)
dlgSaveFile.Flags = 2
dlgSaveFile.ShowSave
strPbzFileName = dlgSaveFile.FileName

If strPbzFileName <> "" Then
'First we need to open the pbz file for writing
Set txsPbzText = fsoPbzFile.CreateTextFile(strPbzFileName, True,
False)
Else
Set txsPbzText = Nothing
End If

Set GetPbzFile = txsPbzText

End Function
0 Likes
Message 6 of 6

Anonymous
Not applicable
Hello,

I have a program that uses this function. It works fine on my computer
but gives an error on everyone elses. The error is "Run-time error 429:
activex component can't create object". I've highlighted where the
program stops when I debug

Private Function GetPbzFile() As TextStream
'dimension locals
Dim dlgSaveFile As New CommonDialog
Dim strPbzFileName As String
Dim fsoPbzFile As New FileSystemObject
Dim txsPbzText As TextStream

'set the common save file dialog properties
****************dlgSaveFile.DialogTitle = "Export PBZ
File"*******************stops here
dlgSaveFile.DefaultExt = ".pbz"
dlgSaveFile.Filter = "Handtman (Pbz) File|*.Pbz"

'open the common save file dialog & display the file name
'in the textbox (txtFileName)
dlgSaveFile.Flags = 2
dlgSaveFile.ShowSave
strPbzFileName = dlgSaveFile.FileName

If strPbzFileName <> "" Then
'First we need to open the pbz file for writing
Set txsPbzText = fsoPbzFile.CreateTextFile(strPbzFileName, True,
False)
Else
Set txsPbzText = Nothing
End If

Set GetPbzFile = txsPbzText

End Function
0 Likes