Variable problem : out of range

  • Thread starter Thread starter Matthieu
  • Start date Start date
M

Matthieu

Hi
I have a problem with this porcedure.
I ask the user to choose the file he wants to open.
And get this value to the variable dealer.
The workbook opens correctly, but when I try to activatite it I have

Run-Time error '9'
Subscript out of range.

( which is normal, because dealer contains all the path to the workbook)
What can I do ?

Exemple follows.
Thanks
Matthieu

Dim dealer
dealer = Application.GetOpenFilename
If VarType(dealer) = vbBoolean Then GoTo GestError _
Else: MsgBox "fichier selectionnee:" & dealer

Workbooks.Open dealer
Workbooks(dealer).Activate
 
Hi:

Try instead

Workbooks(Workboos.Count).Activate

Regards,

Naresh Nichani
Microsoft Access MVP
 
Back
Top