+ Reply to Thread
Results 1 to 6 of 6

Automaticaly open folder needed

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    charleroi
    MS-Off Ver
    Excel 2007
    Posts
    4

    Automaticaly open folder needed

    Here is my problem, I have a Macro which transfer the rows of my choice from one file to another. But every time I click on the export button I have settled, the user needs to find the way back to the folder he needs. So I would like to have instantly acces when I click on the export button to the folder where the file is.

    Here is the part of the macro I think there should be something to modify:

    Option Explicit

    Function SelectSingleFile(Optional Titre As String) As String

    Dim Filter As String, Title As String
    Dim FilterIndex As Integer
    Dim Filename As Variant
    Dim UNCPath As String

    ' File filters
    Filter = "Excel Files (*.xlsx),*.xlsx," & _
    "All Files (*.*),*.*"
    ' Default Filter to *.*
    FilterIndex = 3
    ' Set Dialog Caption
    If Titre <> "" Then
    Title = Titre
    Else
    Title = "Select a file to process"
    End If

    ' Select Start Drive & Path

    ChDir (Application.Path)

    With Application
    ' Set File Name to selected File
    Filename = .GetOpenFilename(Filter, FilterIndex, Title)
    ' Reset Start Drive/Path
    'ChDrive (Left(.DefaultFilePath, 1))
    'ChDir (.DefaultFilePath)
    End With
    ' Exit on Cancel
    If Filename = False Then
    MsgBox "No file was selected."
    SelectSingleFile = ""
    Exit Function
    End If

    SelectSingleFile = Filename

    Thank you in advance

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Automaticaly open folder needed

    attach a sample file with entire code
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    04-04-2013
    Location
    charleroi
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Automaticaly open folder needed

    Export form.docxUtilities.docx

    Here you are

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Automaticaly open folder needed

    I mean xlsm file for testing

  5. #5
    Registered User
    Join Date
    04-04-2013
    Location
    charleroi
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Automaticaly open folder needed

    TEmplate test.xlsm

    I hope this is what you meant

  6. #6
    Registered User
    Join Date
    04-04-2013
    Location
    charleroi
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Automaticaly open folder needed

    Quote Originally Posted by patel45 View Post
    I mean xlsm file for testing
    Hi Patel, did you see my answer with the file?

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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