View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Umlas Bob Umlas is offline
external usenet poster
 
Posts: 301
Default Need to make things simpler

FName will contain the entire path, so the left 3 chars will be something
like C:\
Use FileName = Dir(Fname)
now Filename will be only the name, without the path.
Bob Umlas
Excel MVP

"hshayh0rn" wrote in message
...
I have a workbook that I run the following code in:

Dim FName As Variant
Dim BankNum As Integer
Dim i As Long
Dim aryWBs
ChDrive ActiveWorkbook.Path
ChDir ActiveWorkbook.Path
FName = Application.GetOpenFilename("CSV Files,*.csv",

MultiSelect:=True)
ReDim aryWBs(LBound(FName) To UBound(FName))
For i = LBound(FName) To UBound(FName)
Set aryWBs(i) = Workbooks.Open(FName(i))


Application.ScreenUpdating = False
Next


I then display an input box that asks the user for a 3 digit number that
corresponds to the files they just opened. I would like to eliminate the

need
for the input box but pulling the first three characters from any one of

the
files that were just opened. All of the file they user will open will be
preceeded by a 3 digit number and that 3 digit number is the number I have
been asking them to input. I tried to do something like:

Dim BankNum as Integer
BankNum = Left(FName, 3)

or

Dim BankNum as String
BankNum = Left(FName, 3)

BUT neiher seemed to work down the road. Can anyone help?