Hi all,
I am very new to macros and VBA in excel and am having difficulty with one particular thing. I have managed to get the open file dialog to point to a particular folder on a network drive (Q). What I want is for it to point there if the user is logged on, i.e. Q is available, but if not goto "C:\Documents and Settings".
I have looked all over various message boards for a solution and have tried to cobble something together, but have failed completely.
My original code was:
ChDrive "Q"
ChDir "Q:\Link Files\Housing\PR"
This works fine, but obviously produces an error if not logged into the network. So I tried:
With drive
On Error GoTo Cdrive
ChDrive "Q"
ChDir "Q:\Link Files\Housing\PR"
Cdrive:
ChDrive "C"
ChDir "C:\Documents and Settings"
End With
I know this probably looks ridiculous to people who know about VBA, but I thought I would give it a go - have tried a number of variations to no avail.
Any help appreciated.
Thanks
I am very new to macros and VBA in excel and am having difficulty with one particular thing. I have managed to get the open file dialog to point to a particular folder on a network drive (Q). What I want is for it to point there if the user is logged on, i.e. Q is available, but if not goto "C:\Documents and Settings".
I have looked all over various message boards for a solution and have tried to cobble something together, but have failed completely.
My original code was:
ChDrive "Q"
ChDir "Q:\Link Files\Housing\PR"
This works fine, but obviously produces an error if not logged into the network. So I tried:
With drive
On Error GoTo Cdrive
ChDrive "Q"
ChDir "Q:\Link Files\Housing\PR"
Cdrive:
ChDrive "C"
ChDir "C:\Documents and Settings"
End With
I know this probably looks ridiculous to people who know about VBA, but I thought I would give it a go - have tried a number of variations to no avail.
Any help appreciated.
Thanks