Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 5 of 5

Thread: How to create Userform in excel to open particular file location

  1. #1
    Join Date
    21st May 2013
    Posts
    9

    How to create Userform in excel to open particular file location

    Hi All,

    I am working on a project where i am having 8 excel files saved at diffrent location so i want to create userform which will open particular file location and from that user can select the file which he want and then can go further. so i need a coding so that user will be prompt 8 times with file location. for eg. once user select particular file from location then again this code route him to select next file from file location. is it possible??

    I tried using below code but in this code when i run userform file is not opening but when i run this code mannually by pressing F8 desired file is opening i dont know what is glitch in this ?? is there any othe code or method which can help me ?? another problem i am facing is not able to understand how to repeat this steps again to open another file using this code??

    VB:
    Private Sub Commandbutton1_Click() 
        Dim f As FileDialog 
        Set f = Application.FileDialog(msoFileDialogFilePicker) 
        With f 
            MsgBox "select Diamond file" 
            .Title = "Select a Diamond file..." 
            .InitialFileName = "H:\Working\macro" 
            .ButtonName = "Select" 
             '.Filters.Add "Excel Files", "*.xls", 1
            .AllowMultiSelect = False 
            If .Show = -1 Then 
                 ' Below line will put the selected file path in the textbox
                TextBox1.Text = .SelectedItems.Item(1) 
                Shell "cmd /c " & """" & .SelectedItems(1) & """" 
            End If 
        End With 'Reset default file path for Open/Save dialogs
         'Dim dfp As String
         'dfp = Application.DefaultFilePath
         'ChDrive Left(dfp, 1)
         'ChDir Application.DefaultFilePath
         'Set f = Nothing
    End Sub 
    
    
    if someone know any answer help me with this ... cause if someone can crack this i can save arround daily 4 hrs of my work

    Thanks in advance !!

    Suyog patil
    Last edited by suyogpatil; May 22nd, 2013 at 22:56. Reason: as suggested by forum rules

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    1st September 2010
    Posts
    7,335

    Re: How to create Userform in excel to open particular file location

    Please edit your post to include code tags around the code listing. Code tags format and colourise the code making it easier to read and so follow the logic. Code tags are required by the rules you agreed to when you joined the forum and must be used regardless how long, or short, the code is.

    To add code tags, edit your message, highlight the code and click the '#' button on the edit panel toolbar.

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    21st May 2013
    Posts
    9

    Re: How to create Userform in excel to open particular file location

    ohhhk got it thanks i am new to this forum so not aware about all rules

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    1st September 2010
    Posts
    7,335

    Re: How to create Userform in excel to open particular file location

    You checked to box to say you agreed to them when you joined... !

    Might suggest you click the 'Rules' link under your name in a post, and have a read. It'll take all of a minute or 2.

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    21st May 2013
    Posts
    9

    Re: How to create Userform in excel to open particular file location

    Hi can someone help me in this ... Thanks in advance !!

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Replies: 7
    Last Post: January 19th, 2012, 20:26
  2. Replies: 2
    Last Post: April 7th, 2011, 15:23
  3. Create vbs File To Open Workbook
    By VBA_Worker2 in forum EXCEL HELP
    Replies: 1
    Last Post: August 13th, 2008, 21:40
  4. macro to open word file from same location as xl file
    By Rachel Davis in forum EXCEL HELP
    Replies: 2
    Last Post: November 2nd, 2005, 08:01
  5. File location error when opening Excel 2000 files.
    By Gary Bishop in forum EXCEL HELP
    Replies: 3
    Last Post: December 1st, 2003, 13:27

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
  •  
porno