A
Alfred
Hi all,
Since many years I use the following macro that suits my needs:
Sub FileOpen ( )
SendKeys “+({TAB})”
Dialogs(wdDialogFileOpen).Application.Caption = " "
Dialogs (wdDialogFileOpen). Show
On Error Resume Next
ActiveDocument.ActiveWindow.Caption = _
ActiveDocument.ActiveWindow.Caption
" "
End Sub
The FileOpen Dialog has one setback, however: it does not allow to
open multiple files at once (‘error 5174, file cannot be found’)
Opening multiple files using a right click also gives an error (‘there
is another active dialog running’)
According to the Microsoft webpages this behavior is by default.
I found two work-arounds or solutions which, however, I cannot get to
work.
The first workaround is :
CommandBars.FindControl(ID:=23, Visible:=False).Execute
instead of:
Dialogs(wdDialogFileOpen)
This gives the error: ‘Method Execute of CommandBarButton failed’
The second is:
Sub ShowFileDialog()
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)
With dlgOpen
.AllowMultiSelect = True
.Show
End With
End Sub
This macro gives a VB ‘compiling error’. It might be VBA code. If so,
how to implement it in a VB6 macro?
My question in short:
I want to use my original code (as mentioned in the beginning of this
message) and keep the ability of opening multiple files at once
(without extra message boxes, toolbars or buttons). I use Windows XP,
Word 2003 and VB6.
Anyone can help?
Thanks,
Alfred
Since many years I use the following macro that suits my needs:
Sub FileOpen ( )
SendKeys “+({TAB})”
Dialogs(wdDialogFileOpen).Application.Caption = " "
Dialogs (wdDialogFileOpen). Show
On Error Resume Next
ActiveDocument.ActiveWindow.Caption = _
ActiveDocument.ActiveWindow.Caption
" "
End Sub
The FileOpen Dialog has one setback, however: it does not allow to
open multiple files at once (‘error 5174, file cannot be found’)
Opening multiple files using a right click also gives an error (‘there
is another active dialog running’)
According to the Microsoft webpages this behavior is by default.
I found two work-arounds or solutions which, however, I cannot get to
work.
The first workaround is :
CommandBars.FindControl(ID:=23, Visible:=False).Execute
instead of:
Dialogs(wdDialogFileOpen)
This gives the error: ‘Method Execute of CommandBarButton failed’
The second is:
Sub ShowFileDialog()
Dim dlgOpen As FileDialog
Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)
With dlgOpen
.AllowMultiSelect = True
.Show
End With
End Sub
This macro gives a VB ‘compiling error’. It might be VBA code. If so,
how to implement it in a VB6 macro?
My question in short:
I want to use my original code (as mentioned in the beginning of this
message) and keep the ability of opening multiple files at once
(without extra message boxes, toolbars or buttons). I use Windows XP,
Word 2003 and VB6.
Anyone can help?
Thanks,
Alfred