Open and display directory spreadsheets for user to select and edit

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:49 PM GMT

Question

Hi Aidan I want to be able to display allspreadsheets in a particular directory for the user so they can open and edit any particular one. I've played around in VB6 using the drive, directory, and subfolder objects in the toolbox, but it all seems a bit long winded - I want it to simply default to the directory path and allow them to select which spreadsheet they want to edit.

Answer

Perhaps I'm missing something here, but it sounds as though you simply need to set the Current Directory and then display the file open dialog box?

Sub Get_Data() ChDrive "C:\" ChDir "C:\Testing\" FileToOpen = Application.GetOpenFilename _ (Title:="Please choose a file to import", _ FileFilter:="Excel Files *.xls (*.xls),")If FileToOpen = False Then MsgBox "No file specified.", vbExclamation, "Duh!!!" Exit Sub Else Workbooks.Open Filename:=FileToOpen End If End Sub

>>So - my Google search gave the same result as the search at work - so there you have it - my other skill you see is using search engines!!!!

would do it for you - amend as necessary!

Advertisement

©2024 eLuminary LLC. All rights reserved.