USERFORM TO SEARCH FILE EXPLORER

geno32080

Board Regular
Joined
Jan 23, 2020
Messages
107
Office Version
  1. 2013
Platform
  1. Windows
Has anyone ever used a UserForm to open File Explorer, and be able scroll to a file, and click on a command button on the Userform to select that file? I have a Excel template, from there I have a command button that opens a Userform, this is where I would like to have that option of scrolling thru file explorer and choosing a past work book and have it open that work book, copy some specified cells, close that work book and paste the copied cells to specific cells on the template. Think that's possible?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Research msoFileDialogFilePicker for files, msoFileDialogFolderPicker for folders. Button click event on form could run code for this. Once the dialog returns the path of the selected file/folder your could would open the workbook, copy the range and paste into the target workbook. I probably wouldn't close the source file until the paste is successful.
If the source file range is edited, your copy would be out of sync so is this the best approach? Can you not just specify the source workbook as a linked data source which then causes the target file to remain current?
 
Upvote 0
Research msoFileDialogFilePicker for files, msoFileDialogFolderPicker for folders. Button click event on form could run code for this. Once the dialog returns the path of the selected file/folder your could would open the workbook, copy the range and paste into the target workbook. I probably wouldn't close the source file until the paste is successful.
If the source file range is edited, your copy would be out of sync so is this the best approach? Can you not just specify the source workbook as a linked data source which then causes the target file to remain current?
Nothing is in stone. right now I'm creating the idea of how it could work. I'm basically converting a work order to a Invoice. The template being the Invoice and the sheet to open and copy from is the work order.
 
Upvote 0
Decided to experiment with the msoFileDialogOpen
Followed this advice.
Add a Userform.
Add a ComboBox to the userform.
Change the Name property to "cboFileName".
Change the DropButtonStyle property to "fmDropButtonStyleEllipsis".
Add a CommandButton to the userform.
Change the Caption property to "Cancel"
Double click on the combobox and add a handler for the "DropButtonClick" event. ( this is a confusing term, the instructions say to use the UNC path, I've tried it both ways,\\folder\file name, and C:\folder\ file name, when I click on the ellipsis, I can't get it to show the path to select a file)

This suppose to allow you to browse for a folder or file location when the ellipsis is pressed.
Any one have any Ideas?
 
Upvote 0
Post the code?
Not much coding required, Other than what is above, This is the coding for the userfrom,

Private Sub ComboBox1_Change() "fmDropButtonStyleEllipsis".
C:\LARL EXTREME CLEANING\
End Sub

Private Sub CommandButton1_Click() SELECT ORDER BUTTON

End Sub

Private Sub CommandButton2_Click() CANCLE BUTTON
Me.Hide
End Sub

Private Sub UserForm_Initialize()
HideTitleBar Me
End Sub

1643489934208.png
 
Upvote 0
Sorry, you lost me. I see 2 procedures (the 1st two you posted) that do nothing and 2 that have nothing to do with the file dialog you asked about.
 
Upvote 0
Sorry, you lost me. I see 2 procedures (the 1st two you posted) that do nothing and 2 that have nothing to do with the file dialog you asked about
It is kinda confusing, I could post a couple of screen shots? I uploaded the work book to google drive,
Let see if I can get you a copy of the work book.
 
Upvote 0

Forum statistics

Threads
1,215,632
Messages
6,125,909
Members
449,274
Latest member
mrcsbenson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top