Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default opening other workbooks at the same time

How do I add another drive to search for when loading the workbooks
listed below.

Problem is when I use these files on my pen drive at home / work and
other PCs the pen might be recognised as a different drive letter on
each one.

I only need it look in say "f" and "g" and that will do the job.

Many thanks

John


EXAMPLE

Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default opening other workbooks at the same time

I'll let you fill in the filenames, but this will check if a file exists in
F drive.
If it exists it will open it.
If not will open it from G.
There is no error checking so if you forget to plug the drive in or it has
another drive letter it won't work.

Sub test()
If Len(Dir("f:\test.xlsx")) 0 Then
Workbooks.Open ("f:\test.xls")
Else
Workbooks.Open ("g:\test.xls")
End If
End Sub

Regards
Steve


"Johnnyboy5" wrote in message
...
How do I add another drive to search for when loading the workbooks
listed below.

Problem is when I use these files on my pen drive at home / work and
other PCs the pen might be recognised as a different drive letter on
each one.

I only need it look in say "f" and "g" and that will do the job.

Many thanks

John


EXAMPLE

Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default opening other workbooks at the same time

On 9 June, 10:43, "steve" wrote:
I'll let you fill in the filenames, but this will check if a file exists in
F drive.
If it exists it will open it.
If not will open it from G.
There is no error checking so if you forget to plug the drive in or it has
another drive letter it won't work.

Sub test()
* * If Len(Dir("f:\test.xlsx")) 0 Then
* * * * Workbooks.Open ("f:\test.xls")
* * * * Else
* * * * Workbooks.Open ("g:\test.xls")
* * End If
End Sub

Regards
* Steve

"Johnnyboy5" wrote in message

...



How do I add another drive to search for when loading the workbooks
listed below.


Problem is when I use these files on my pen drive at home / work and
other PCs *the pen might be recognised as a different drive letter on
each one.


I only need it look in say *"f" *and "g" and that will do the job.


Many thanks


John


EXAMPLE


Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")- Hide quoted text -


- Show quoted text -


Thanks - cant try it til tonight - thanks - will let you know how it
goes

Johnnyboy
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default opening other workbooks at the same time

On 9 June, 10:43, "steve" wrote:
I'll let you fill in the filenames, but this will check if a file exists in
F drive.
If it exists it will open it.
If not will open it from G.
There is no error checking so if you forget to plug the drive in or it has
another drive letter it won't work.

Sub test()
* * If Len(Dir("f:\test.xlsx")) 0 Then
* * * * Workbooks.Open ("f:\test.xls")
* * * * Else
* * * * Workbooks.Open ("g:\test.xls")
* * End If
End Sub

Regards
* Steve

"Johnnyboy5" wrote in message

...



How do I add another drive to search for when loading the workbooks
listed below.


Problem is when I use these files on my pen drive at home / work and
other PCs *the pen might be recognised as a different drive letter on
each one.


I only need it look in say *"f" *and "g" and that will do the job.


Many thanks


John


EXAMPLE


Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")- Hide quoted text -


- Show quoted text -


Hi

Couldn't wait so tried to do it in work.

not sure how i should be writing this code out, is it .... ?

Sub test()

If Len(Dir("g:\Direct Payments DOT\1 payments cheryl.xls")) 0
Then
Workbooks.Open ("g:\Direct Payments DOT\1 payments
cheryl.xls")

Else
Workbooks.Open ("f:\Direct Payments DOT\1 payments
cheryl.xls")


If Len(Dir("g:\Direct Payments DOT\1 payments Sandra.xls")) 0
Then
Workbooks.Open ("g:\Direct Payments DOT\1 payments
Sandra.xls")

Else
Workbooks.Open ("f:\Direct Payments DOT\1 payments
Sandra.xls")


ECT ECT


Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")

End If
End Sub


thanks

John



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default opening other workbooks at the same time

You only need to check if one of the files is on the F drive and it will
open them all.
Otherwise it will open them all from the G drive.

Sub test()
If Len(Dir("f:\Direct Payments DOT\1 payments cheryl.xls")) 0 Then
Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly paymentplanner.xls")
Else
Workbooks.Open ("g\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("g\Direct Payments DOT\1 payments Sandra.xls") '
Workbooks.Open ("g\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("g\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("g\Direct Payments DOT\0.5 yearly paymentplanner.xls")
End If
End Sub

Regards
Steve

"Johnnyboy5" wrote in message
...
On 9 June, 10:43, "steve" wrote:
I'll let you fill in the filenames, but this will check if a file exists
in
F drive.
If it exists it will open it.
If not will open it from G.
There is no error checking so if you forget to plug the drive in or it has
another drive letter it won't work.

Sub test()
If Len(Dir("f:\test.xlsx")) 0 Then
Workbooks.Open ("f:\test.xls")
Else
Workbooks.Open ("g:\test.xls")
End If
End Sub

Regards
Steve

"Johnnyboy5" wrote in message

...



How do I add another drive to search for when loading the workbooks
listed below.


Problem is when I use these files on my pen drive at home / work and
other PCs the pen might be recognised as a different drive letter on
each one.


I only need it look in say "f" and "g" and that will do the job.


Many thanks


John


EXAMPLE


Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")- Hide quoted text -


- Show quoted text -


Hi

Couldn't wait so tried to do it in work.

not sure how i should be writing this code out, is it .... ?

Sub test()

If Len(Dir("g:\Direct Payments DOT\1 payments cheryl.xls")) 0
Then
Workbooks.Open ("g:\Direct Payments DOT\1 payments
cheryl.xls")

Else
Workbooks.Open ("f:\Direct Payments DOT\1 payments
cheryl.xls")


If Len(Dir("g:\Direct Payments DOT\1 payments Sandra.xls")) 0
Then
Workbooks.Open ("g:\Direct Payments DOT\1 payments
Sandra.xls")

Else
Workbooks.Open ("f:\Direct Payments DOT\1 payments
Sandra.xls")


ECT ECT


Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")

End If
End Sub


thanks

John






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default opening other workbooks at the same time

On 9 June, 12:41, "steve" wrote:
You only need to check if one of the files is on the F drive and it will
open them all.
Otherwise it will open them all from the G drive.

Sub test()
If Len(Dir("f:\Direct Payments DOT\1 payments cheryl.xls")) 0 Then
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
* * Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly paymentplanner..xls")
Else
* * Workbooks.Open ("g\Direct Payments DOT\1 payments cheryl.xls")
* * Workbooks.Open ("g\Direct Payments DOT\1 payments Sandra.xls") '
* * Workbooks.Open ("g\Direct Payments DOT\1 payments Liv.xls")
* * Workbooks.Open ("g\Direct Payments DOT\1 payments Sally.xls")
* * Workbooks.Open ("g\Direct Payments DOT\0.5 yearly paymentplanner.xls")
End If
End Sub

Regards
* Steve

"Johnnyboy5" wrote in message

...
On 9 June, 10:43, "steve" wrote:





I'll let you fill in the filenames, but this will check if a file exists
in
F drive.
If it exists it will open it.
If not will open it from G.
There is no error checking so if you forget to plug the drive in or it has
another drive letter it won't work.


Sub test()
If Len(Dir("f:\test.xlsx")) 0 Then
Workbooks.Open ("f:\test.xls")
Else
Workbooks.Open ("g:\test.xls")
End If
End Sub


Regards
Steve


"Johnnyboy5" wrote in message


...


How do I add another drive to search for when loading the workbooks
listed below.


Problem is when I use these files on my pen drive at home / work and
other PCs the pen might be recognised as a different drive letter on
each one.


I only need it look in say "f" and "g" and that will do the job.


Many thanks


John


EXAMPLE


Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")- Hide quoted text -


- Show quoted text -


Hi

Couldn't wait so tried to do it in work.

not sure how i should be writing this code out, * is it .... ?

Sub test()

* * If Len(Dir("g:\Direct Payments DOT\1 payments cheryl.xls")) 0
Then
* * * * Workbooks.Open ("g:\Direct Payments DOT\1 payments
cheryl.xls")

* * * * Else
* * * * Workbooks.Open ("f:\Direct Payments DOT\1 payments
cheryl.xls")

* * If Len(Dir("g:\Direct Payments DOT\1 payments Sandra.xls")) 0
Then
* * * * Workbooks.Open ("g:\Direct Payments DOT\1 payments
Sandra.xls")

* * Else
* * * * Workbooks.Open ("f:\Direct Payments DOT\1 payments
Sandra.xls")

ECT *ECT

Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")

End If
End Sub

thanks

John- Hide quoted text -

- Show quoted text -


Awesome ! thanks V V much -

John.
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default opening other workbooks at the same time

On 9 June, 12:41, "steve" wrote:
You only need to check if one of the files is on the F drive and it will
open them all.
Otherwise it will open them all from the G drive.

Sub test()
If Len(Dir("f:\Direct Payments DOT\1 payments cheryl.xls")) 0 Then
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
* * Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
* * Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly paymentplanner..xls")
Else
* * Workbooks.Open ("g\Direct Payments DOT\1 payments cheryl.xls")
* * Workbooks.Open ("g\Direct Payments DOT\1 payments Sandra.xls") '
* * Workbooks.Open ("g\Direct Payments DOT\1 payments Liv.xls")
* * Workbooks.Open ("g\Direct Payments DOT\1 payments Sally.xls")
* * Workbooks.Open ("g\Direct Payments DOT\0.5 yearly paymentplanner.xls")
End If
End Sub

Regards
* Steve

"Johnnyboy5" wrote in message

...
On 9 June, 10:43, "steve" wrote:





I'll let you fill in the filenames, but this will check if a file exists
in
F drive.
If it exists it will open it.
If not will open it from G.
There is no error checking so if you forget to plug the drive in or it has
another drive letter it won't work.


Sub test()
If Len(Dir("f:\test.xlsx")) 0 Then
Workbooks.Open ("f:\test.xls")
Else
Workbooks.Open ("g:\test.xls")
End If
End Sub


Regards
Steve


"Johnnyboy5" wrote in message


...


How do I add another drive to search for when loading the workbooks
listed below.


Problem is when I use these files on my pen drive at home / work and
other PCs the pen might be recognised as a different drive letter on
each one.


I only need it look in say "f" and "g" and that will do the job.


Many thanks


John


EXAMPLE


Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")- Hide quoted text -


- Show quoted text -


Hi

Couldn't wait so tried to do it in work.

not sure how i should be writing this code out, * is it .... ?

Sub test()

* * If Len(Dir("g:\Direct Payments DOT\1 payments cheryl.xls")) 0
Then
* * * * Workbooks.Open ("g:\Direct Payments DOT\1 payments
cheryl.xls")

* * * * Else
* * * * Workbooks.Open ("f:\Direct Payments DOT\1 payments
cheryl.xls")

* * If Len(Dir("g:\Direct Payments DOT\1 payments Sandra.xls")) 0
Then
* * * * Workbooks.Open ("g:\Direct Payments DOT\1 payments
Sandra.xls")

* * Else
* * * * Workbooks.Open ("f:\Direct Payments DOT\1 payments
Sandra.xls")

ECT *ECT

Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")

End If
End Sub

thanks

John- Hide quoted text -

- Show quoted text -


Me again. sorry tried it it doesnt run when I open the main sheet 0.5
yearly payment planner.

I think something about open_workbook () is missing - the other code i
used will open the other workbooks when the "main" open is opened
first. Hope this makes sense.

John
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default opening other workbooks at the same time

Do you have the other code, so I could take a look.

Regards
Steve

"Johnnyboy5" wrote in message
...
On 9 June, 12:41, "steve" wrote:
You only need to check if one of the files is on the F drive and it will
open them all.
Otherwise it will open them all from the G drive.

Sub test()
If Len(Dir("f:\Direct Payments DOT\1 payments cheryl.xls")) 0 Then
Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly paymentplanner.xls")
Else
Workbooks.Open ("g\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("g\Direct Payments DOT\1 payments Sandra.xls") '
Workbooks.Open ("g\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("g\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("g\Direct Payments DOT\0.5 yearly paymentplanner.xls")
End If
End Sub

Regards
Steve

"Johnnyboy5" wrote in message

...
On 9 June, 10:43, "steve" wrote:





I'll let you fill in the filenames, but this will check if a file exists
in
F drive.
If it exists it will open it.
If not will open it from G.
There is no error checking so if you forget to plug the drive in or it
has
another drive letter it won't work.


Sub test()
If Len(Dir("f:\test.xlsx")) 0 Then
Workbooks.Open ("f:\test.xls")
Else
Workbooks.Open ("g:\test.xls")
End If
End Sub


Regards
Steve


"Johnnyboy5" wrote in message


...


How do I add another drive to search for when loading the workbooks
listed below.


Problem is when I use these files on my pen drive at home / work and
other PCs the pen might be recognised as a different drive letter on
each one.


I only need it look in say "f" and "g" and that will do the job.


Many thanks


John


EXAMPLE


Workbooks.Open ("f:\Direct Payments DOT\1 payments cheryl.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sandra.xls") '
Change as required
Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")- Hide quoted text -


- Show quoted text -


Hi

Couldn't wait so tried to do it in work.

not sure how i should be writing this code out, is it .... ?

Sub test()

If Len(Dir("g:\Direct Payments DOT\1 payments cheryl.xls")) 0
Then
Workbooks.Open ("g:\Direct Payments DOT\1 payments
cheryl.xls")

Else
Workbooks.Open ("f:\Direct Payments DOT\1 payments
cheryl.xls")

If Len(Dir("g:\Direct Payments DOT\1 payments Sandra.xls")) 0
Then
Workbooks.Open ("g:\Direct Payments DOT\1 payments
Sandra.xls")

Else
Workbooks.Open ("f:\Direct Payments DOT\1 payments
Sandra.xls")

ECT ECT

Workbooks.Open ("f:\Direct Payments DOT\1 payments Liv.xls")
Workbooks.Open ("f:\Direct Payments DOT\1 payments Sally.xls")
Workbooks.Open ("f:\Direct Payments DOT\0.5 yearly payment
planner.xls")

End If
End Sub

thanks

John- Hide quoted text -

- Show quoted text -


Me again. sorry tried it it doesnt run when I open the main sheet 0.5
yearly payment planner.

I think something about open_workbook () is missing - the other code i
used will open the other workbooks when the "main" open is opened
first. Hope this makes sense.

John


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening new workbooks Falcon248 Excel Discussion (Misc queries) 0 January 22nd 10 07:09 PM
Opening Workbooks [email protected] Excel Programming 3 June 1st 07 02:48 PM
Opening Workbooks Brent Excel Programming 4 April 9th 07 10:30 PM
Opening workbooks calimari Excel Discussion (Misc queries) 2 January 24th 06 12:34 AM
opening 2 excel workbooks at the same time candulj Excel Discussion (Misc queries) 1 March 13th 05 10:57 PM


All times are GMT +1. The time now is 04:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"