Variable problem : out of range

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
 
N

Naresh Nichani MVP

Hi:

Try instead

Workbooks(Workboos.Count).Activate

Regards,

Naresh Nichani
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top