Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Pointing to the Correct Directory

Hi, I'd appreciate help from anyone that can point me in the correct
direction here...

I want to open a spreadsheet (call this A) that includes a VB macro, and the
macro will open another spreadsheet (call this B) that will always be stored
in the same directory as spreadsheet A. Now, at one point during a month,
spreadsheets A and B are in one directory, later in the month they gets
moved to a history directory.

What code do I need to use to have the open always point to the directory
that spreadsheet A and B are stored in? Would Curdir be the correct one to
use? Is there a way to retrieve the directory path spreadsheet A is
contained in, and then use that as part of the Open path for spreadsheet B?

TIA for the assistance.

Rodg2000


(remove the _nospam to reply)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Pointing to the Correct Directory

Use...

Workbooks.Open ThisWorkbook.Path & "\Book2.xls"

where

ThisWorkbook.Path = the path of spreadsheet A
"\Book2.xls" = name of spreadsheet B
--
_______________________
Robert Rosenberg
R-COR Consulting Services
Microsoft MVP - Excel
"Rodg2000" wrote in message
...
Hi, I'd appreciate help from anyone that can point me in the correct
direction here...

I want to open a spreadsheet (call this A) that includes a VB macro, and

the
macro will open another spreadsheet (call this B) that will always be

stored
in the same directory as spreadsheet A. Now, at one point during a month,
spreadsheets A and B are in one directory, later in the month they gets
moved to a history directory.

What code do I need to use to have the open always point to the directory
that spreadsheet A and B are stored in? Would Curdir be the correct one

to
use? Is there a way to retrieve the directory path spreadsheet A is
contained in, and then use that as part of the Open path for spreadsheet

B?

TIA for the assistance.

Rodg2000


(remove the _nospam to reply)




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Pointing to the Correct Directory

Robert,

Thanks for the quick response! Exactly what I needed.

Rodg2000

"Robert Rosenberg" wrote in message
...
Use...

Workbooks.Open ThisWorkbook.Path & "\Book2.xls"

where

ThisWorkbook.Path = the path of spreadsheet A
"\Book2.xls" = name of spreadsheet B
--
_______________________
Robert Rosenberg
R-COR Consulting Services
Microsoft MVP - Excel
"Rodg2000" wrote in message
...
Hi, I'd appreciate help from anyone that can point me in the correct
direction here...

I want to open a spreadsheet (call this A) that includes a VB macro, and

the
macro will open another spreadsheet (call this B) that will always be

stored
in the same directory as spreadsheet A. Now, at one point during a

month,
spreadsheets A and B are in one directory, later in the month they gets
moved to a history directory.

What code do I need to use to have the open always point to the

directory
that spreadsheet A and B are stored in? Would Curdir be the correct one

to
use? Is there a way to retrieve the directory path spreadsheet A is
contained in, and then use that as part of the Open path for spreadsheet

B?

TIA for the assistance.

Rodg2000


(remove the _nospam to reply)






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
How to correct cannot access directory 'J:\\'. ex_usmc_doc Excel Discussion (Misc queries) 1 February 1st 10 03:09 PM
Asterisk pointing to a footnote Ace Excel Discussion (Misc queries) 3 July 20th 09 08:41 PM
Excel pointing me to MS Ofc Install silktraveler New Users to Excel 2 May 25th 09 03:31 AM
pointing to the c:\ drive Cockneygeordie Excel Discussion (Misc queries) 0 July 5th 06 03:34 PM
Have a lookup pointing to a CSV file Murali Krishnan Excel Programming 1 September 24th 03 07:21 PM


All times are GMT +1. The time now is 09:25 AM.

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

About Us

"It's about Microsoft Excel"