Consulting

Results 1 to 4 of 4

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

  1. #1
    VBAX Newbie
    Joined
    Mar 2006
    Posts
    5
    Location

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

    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.

  2. #2
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Hi nishant,

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

    Marcster.

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    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'

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    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]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •