Activate a workbook
sorry, this should be the last line
workbooks(fname).Activate
Sub test()
Dim mspatharray() As String
Dim fpath As Variant
Dim fname As String
ReDim mspatharray(6, 6)
mspatharray(1, 6) = "C:\my files\testfiles.csv"
fpath = Split(mspatharray(1, 6), "\")
fname = fpath(UBound(fpath))
workbooks(fname).Activate
End Sub
--
Gary
"IgorM" wrote in message
...
Hi
I have a macro that enables user to open multiple workbooks or select csv
file which is imported into excel (but not saved as xls file). The path of
each opened file is stored in an array as string (it's 6x6 dimension
array). How can I than use that string (the path) to activate that
specific file. So for instance msPathArray(1,6) stores a string "C:\my
files\testfiles.csv" which is a path to a file that is already opened in
excel. How can I activate that file?
Kind regards
|