PDA

View Full Version : Do we have some functions similar to Dialogs(wdDialogFileOpen).Show to open .xls file



nishant
03-09-2006, 06:19 AM
Dialogs(wdDialogFileOpen).Show is a function which allows user to select a word file and open.
Can anybody tell me similar function which can be used to select a Excel file and open it.:help

Marcster
03-09-2006, 06:55 AM
Hi nishant,

This is possible.
Which version of Office are you using?.
Where are you using this, in Excel or Word?.

Marcster.

mdmackillop
03-09-2006, 05:33 PM
xlDialogOpen

Check the Dialog Object in Help and also Built-In Dialog Box Argument Lists

Jacob Hilderbrand
03-09-2006, 05:55 PM
I use this:


Option Explicit

Sub Macro1()

Dim Path As String
Dim Prompt As String
Dim Title As String
Dim Wkb As Workbook

Prompt = "Select the file to open."
Title = "File Specification"
MsgBox Prompt, vbInformation, Title
Path = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If Path = "False" Then
GoTo ExitSub:
End If

Set Wkb = Workbooks.Open(FileName:=Path)

ExitSub:

Set Wkb = Nothing

End Sub