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.![]()
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.![]()
Hi nishant,
This is possible.
Which version of Office are you using?.
Where are you using this, in Excel or Word?.
Marcster.
xlDialogOpen
Check the Dialog Object in Help and also Built-In Dialog Box Argument Lists
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
I use this:
[vba]
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[/vba]