Hi All,
Is there a way to make the contents of a particular cell in a worksheet show where to pick up another file. Here is my code to pick up a file:
Sub workOnSheet()
Dim FileName As Variant
Dim Filt As String, Title As String
Dim FilterIndex As Integer, Response As Integer
Dim NameOnly As String
' Set Drive letter
ChDrive "E:\"
' Set to Specified Path\Folder
ChDir "E:\PATH HERE"
' Set File Filter
'Filt = "PID files (*.pid), *.pid"
Filt = "PIW files (*.xls), *.xls"
' Set *.* to Default
FilterIndex = 5
' Set Dialogue Box Caption
Title = "Please select a different File"
' Get FileName
FileName = Application.GetOpenFilename(FileFilter:=Filt, _
FilterIndex:=FilterIndex, Title:=Title)
' Exit if Dialogue box cancelled
If FileName = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical, "Selection Error")
End
Exit Sub
End If
' Display Full Path & File Name
Response = MsgBox("You selected " & FileName, vbInformation, "Proceed")
NameOnly = GetFileName(CStr(FileName))
DEFName = NameOnly
' Open Selected Workbook
Workbooks.Open FileName
Then, I need to be able to pickup the path and drive from a cell out of a particular worksheet so I user can change it when they move the project around.
Lets say I want to put the drive and path under A1 and A2 in workbook named KittyCat where a user can go in and change it. How would I alter the code above to make it accept this. Thank you for any help you can provide on this!!!
Bookmarks