+ Reply to Thread
Results 1 to 3 of 3

open file path

Hybrid View

Bigelk open file path 10-18-2011, 07:52 AM
snb Re: open file path 10-18-2011, 08:13 AM
Bigelk Re: open file path 10-18-2011, 09:00 AM
  1. #1
    Registered User
    Join Date
    10-17-2011
    Location
    Lillestrom
    MS-Off Ver
    Excel 2007
    Posts
    3

    open file path

    Hi.

    i'm using Application.GetOpenFilename to open a file. But i want it to
    open the file in the active workbook insted of a new one. and in the sheet that i want.

    Dim FileName As Variant
        Dim Filt As String, Title As String
        Dim FilterIndex As Integer, Response As Integer
        
              ChDrive "H:\"
               ChDir "H:\tonn"
            Filt = "all Files (*.), *."
              FilterIndex = 5
               Title = "Please select a different File"
               FileName = Application.GetOpenFilename(FileFilter:=Filt, _
                FilterIndex:=FilterIndex, Title:=Title)
              If FileName = False Then
                Response = MsgBox("No File was selected", vbOKOnly & vbCritical, "Selection Error")
                Exit Sub
            End If
              Response = MsgBox("You selected " & FileName, vbInformation, "Proceed")
                Workbooks.Open FileName

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: open file path

    You can't import a workbook in a workbook.

    You can insert a databasequery to another workbook.



  3. #3
    Registered User
    Join Date
    10-17-2011
    Location
    Lillestrom
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: open file path

    Thank u for u'r reply. but i think i did'nt make myself clear enough

    it's not a workbook. its a txt file that is saved on the computer. i know how to import a spesific file. but i just want to open the file path and then select the file i want to import with my mouse. but when i do this with the code that i posted. the file is inserted in a new workbook instead og the workbook i'm working in.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1