M
maperalia
Nice to hear from you again. I wonder if I can ask you a question regarding
VBA. I have a program that open an excel file from select cell (see below).
However, this program opens file just from the same directories. What happen
if Ithe last directory changes all the time. For example instead 100 could be
200 or 300 or 400 and so on. Can the program be adjusted to get this new
directory and find the file?
Thanks in advance.
Maperalia.
'***PROGRAM STARTS*****
Sub OpenSelectFilename1()
directory = "C:\Test\Pants\Blue\100 "\"
filetext = Selection.Value & ".xls"
Workbooks.Open directory & filetext
'If filetext = ".xls" Then
'MsgBox "Please a FILE NAME to Open the file"
'End If
End Sub
"***PROGRAM ENDS*******
'***OTHER PROGRAM STARTS*****
'Sub OpenExcelFile()
' directory = ThisWorkbook.Path & "\"
' filetext = Selection.Value & ".xls"
' If filetext = ".xls" Then
' MsgBox "Please a FILE NAME to Open the file"
' Exit Sub
' End If
"***PROGRAM ENDS*******
VBA. I have a program that open an excel file from select cell (see below).
However, this program opens file just from the same directories. What happen
if Ithe last directory changes all the time. For example instead 100 could be
200 or 300 or 400 and so on. Can the program be adjusted to get this new
directory and find the file?
Thanks in advance.
Maperalia.
'***PROGRAM STARTS*****
Sub OpenSelectFilename1()
directory = "C:\Test\Pants\Blue\100 "\"
filetext = Selection.Value & ".xls"
Workbooks.Open directory & filetext
'If filetext = ".xls" Then
'MsgBox "Please a FILE NAME to Open the file"
'End If
End Sub
"***PROGRAM ENDS*******
'***OTHER PROGRAM STARTS*****
'Sub OpenExcelFile()
' directory = ThisWorkbook.Path & "\"
' filetext = Selection.Value & ".xls"
' If filetext = ".xls" Then
' MsgBox "Please a FILE NAME to Open the file"
' Exit Sub
' End If
"***PROGRAM ENDS*******