Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
Documents
/
DEV2
:
VB198.tmp
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
Attribute VB_Name = "Module4" Option Explicit ' Filter Public Const champ = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*|" Public Function Ouvrir_Document() ' ouvrir un document existant On Error GoTo OpenError Dim Fichier_Nom As String Dim I As Integer Dim fType As String With Prog_Frm .CmDlg.CancelError = True .CmDlg.DialogTitle = "Selection du fichier � ouvrir" .CmDlg.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*|" .CmDlg.FilterIndex = 1 .CmDlg.ShowOpen End With Fichier_Nom = Prog_Frm.CmDlg.FileName ' Read selected file into the Text Box. Open strFileName For Input As #1 txtWordProc.Text = Input(LOF(1), 1) Close #1 Form1.Caption = "File Opener - " & cdbWordProc.FileTitle 'For I = 1 To .CmDlg.cFileName.Count 'Open all selected files ' Get file extension ' If UCase(Right(.CmDlg.cFileTitle(I), 3)) = "RTF" Then ' fType = rtfText ' Else ' fType = rtfText ' End If ' CreateNewDocument ' .ActiveForm.rtfText.LoadFile .CmDlg.cFileName(I), fType 'Load file ' .ActiveForm.Caption = .CmDlg.cFileName(I) 'Set form caption ' .ActiveForm.bChanged = False 'Set bChanged flag to false ' SaveMRUFile .CmDlg.cFileName(I) 'Save file into MRU List 'Next End With OpenError: 'If Err.Number = 32755 Then Exit Function 'If canceled then exit function 'ErrorLog "modDocument/OpenDocument" End Function Public Property Get CancelError() As Boolean CancelError = m_CancelError End Property Public Property Let CancelError(ByVal New_CancelError As Boolean) m_CancelError = New_CancelError PropertyChanged "CancelError" End Property Public Property Get Filter() As String Filter = m_Filter End Property Public Property Let Filtre(ByVal New_Filter As String) m_Filter = New_Filter PropertyChanged "Filtre" End Property '***** FILTER INDEX Public Property Get FilterIndex() As Integer FilterIndex = m_FilterIndex End Property Public Property Let FilterIndex(ByVal New_FilterIndex As Integer) m_FilterIndex = New_FilterIndex PropertyChanged "FilterIndex" End Property '***** DIALOG TITLE Public Property Get DialogTitle() As String DialogTitle = m_DialogTitle End Property Public Property Let DialogTitle(ByVal New_DialogTitle As String) m_DialogTitle = New_DialogTitle PropertyChanged "DialogTitle" End Property Public Function ShowOpen() '** Description: '** Calls open dialog without OCX Dim epOFN As OPENFILENAME Dim lngRet As Long With epOFN If MultiSelect Then 'If Multi Select then .Flags = OFN_ALLOWMULTISELECT Or OFN_EXPLORER Or OFN_PATHMUSTEXIST Or OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY .lpstrFile = DefaultFilename & Space(9999 - Len(DefaultFilename)) & vbNullChar .lpstrFileTitle = Space(9999) & vbNullChar Else .Flags = OFN_PATHMUSTEXIST Or OFN_FILEMUSTEXIST Or OFN_HIDEREADONLY .lpstrFile = DefaultFilename & String(MAX_PATH - Len(DefaultFilename), 0) & vbNullChar .lpstrFileTitle = String(MAX_PATH, 0) & vbNullChar End If .hwndOwner = UserControl.ContainerHwnd 'Handle to window .lpstrFilter = SetFilter(Filter) & vbNullChar 'File filter .lpstrInitialDir = InitialDir & vbNullChar 'Initial directory .lpstrTitle = DialogTitle & vbNullChar 'Dialog title .lStructSize = Len(epOFN) 'Structure size in bytes .nFilterIndex = FilterIndex 'Filter index .nMaxFile = Len(.lpstrFile) 'Maximum file length .nMaxFileTitle = Len(.lpstrFileTitle) 'Maximum file title length End With lngRet = GetOpenFileName(epOFN) 'Call open dialog If lngRet <> 0 Then 'If there are no errors continue with opening file ParseFileName epOFN.lpstrFile Else If CancelError Then ' For this to work you must check in Tools\Options\General ' Break on Unhandled errors if it isn't already checked Err.Raise 32755, App.EXEName, "Cancel was selected.", "cmdlg98.chm", 32755 End If End If End Function