Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Linked file in same folder but unknown path

I have a workbook that will gather data from many other workbooks via links.
the other workbooks will always be in the same folder as the workbook
processing the links but I will not know the path of that folder.

I am putting the links in the cells via code like:

Range("b3").Formula = "='[62881.xls]Sheet1'!$B$4"

There are thousands of these links and when I run the code as is, it wants
me to point to the file for each line. How can I set the path to always be
in the current folder, wherever that folder is located?

Thanks in advance for any help
Christy ;)


  #2   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Linked file in same folder but unknown path

At the beginning of the code you can use the CurDir command to set the
current directory. That is if they are all in the same directory.

"Christy" wrote:

I have a workbook that will gather data from many other workbooks via links.
the other workbooks will always be in the same folder as the workbook
processing the links but I will not know the path of that folder.

I am putting the links in the cells via code like:

Range("b3").Formula = "='[62881.xls]Sheet1'!$B$4"

There are thousands of these links and when I run the code as is, it wants
me to point to the file for each line. How can I set the path to always be
in the current folder, wherever that folder is located?

Thanks in advance for any help
Christy ;)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Linked file in same folder but unknown path

Why not just use the ChangeLink method.


It is equivalent to going into Edit=Links, and changing the source of the
link.

however, if the workbooks are in the same folder, you shouldn't need to do
anything. Excel should do what you ask by default (as long as the existing
workbook link isn't valid).

--
Regards,
Tom Ogilvy


"Christy" wrote in message
...
I have a workbook that will gather data from many other workbooks via

links.
the other workbooks will always be in the same folder as the workbook
processing the links but I will not know the path of that folder.

I am putting the links in the cells via code like:

Range("b3").Formula = "='[62881.xls]Sheet1'!$B$4"

There are thousands of these links and when I run the code as is, it wants
me to point to the file for each line. How can I set the path to always

be
in the current folder, wherever that folder is located?

Thanks in advance for any help
Christy ;)




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Linked file in same folder but unknown path

Thanks JNW

I tried that but I don't where to put the CurDir? The link is a cell formula
put in the cell via code.

The code puts a formula linking to the other workbook in a cell. The
procedure is ran on opening the workbook. When I open the file and chose
'update links' an "Update values" windows looking in MyDocuments opens
wanting me to point to the file. This will repeat thousands of times for each
line of code.

I need the links to update without any input from the user.

Christy ;)



"JNW" wrote:

At the beginning of the code you can use the CurDir command to set the
current directory. That is if they are all in the same directory.

"Christy" wrote:

I have a workbook that will gather data from many other workbooks via links.
the other workbooks will always be in the same folder as the workbook
processing the links but I will not know the path of that folder.

I am putting the links in the cells via code like:

Range("b3").Formula = "='[62881.xls]Sheet1'!$B$4"

There are thousands of these links and when I run the code as is, it wants
me to point to the file for each line. How can I set the path to always be
in the current folder, wherever that folder is located?

Thanks in advance for any help
Christy ;)


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Linked file in same folder but unknown path

Correction - the 'update value' window appears as the code is placing the
formulas in the cells. When I click 'enable macros' the window apprears for
each line of code.

???????????

"Christy" wrote:

Thanks JNW

I tried that but I don't where to put the CurDir? The link is a cell formula
put in the cell via code.

The code puts a formula linking to the other workbook in a cell. The
procedure is ran on opening the workbook. When I open the file and chose
'update links' an "Update values" windows looking in MyDocuments opens
wanting me to point to the file. This will repeat thousands of times for each
line of code.

I need the links to update without any input from the user.

Christy ;)



"JNW" wrote:

At the beginning of the code you can use the CurDir command to set the
current directory. That is if they are all in the same directory.

"Christy" wrote:

I have a workbook that will gather data from many other workbooks via links.
the other workbooks will always be in the same folder as the workbook
processing the links but I will not know the path of that folder.

I am putting the links in the cells via code like:

Range("b3").Formula = "='[62881.xls]Sheet1'!$B$4"

There are thousands of these links and when I run the code as is, it wants
me to point to the file for each line. How can I set the path to always be
in the current folder, wherever that folder is located?

Thanks in advance for any help
Christy ;)




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Linked file in same folder but unknown path

If the source workbook is open you shouldn't have that problem.

--
regards,
Tom Ogilvy

"Christy" wrote in message
...
Correction - the 'update value' window appears as the code is placing the
formulas in the cells. When I click 'enable macros' the window apprears

for
each line of code.

???????????

"Christy" wrote:

Thanks JNW

I tried that but I don't where to put the CurDir? The link is a cell

formula
put in the cell via code.

The code puts a formula linking to the other workbook in a cell. The
procedure is ran on opening the workbook. When I open the file and chose
'update links' an "Update values" windows looking in MyDocuments opens
wanting me to point to the file. This will repeat thousands of times for

each
line of code.

I need the links to update without any input from the user.

Christy ;)



"JNW" wrote:

At the beginning of the code you can use the CurDir command to set the
current directory. That is if they are all in the same directory.

"Christy" wrote:

I have a workbook that will gather data from many other workbooks

via links.
the other workbooks will always be in the same folder as the

workbook
processing the links but I will not know the path of that folder.

I am putting the links in the cells via code like:

Range("b3").Formula = "='[62881.xls]Sheet1'!$B$4"

There are thousands of these links and when I run the code as is, it

wants
me to point to the file for each line. How can I set the path to

always be
in the current folder, wherever that folder is located?

Thanks in advance for any help
Christy ;)




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Linked file in same folder but unknown path

Thanks Tom, opening the file eliminated the problem.

Christy ;)

"Tom Ogilvy" wrote:

If the source workbook is open you shouldn't have that problem.

--
regards,
Tom Ogilvy

"Christy" wrote in message
...
Correction - the 'update value' window appears as the code is placing the
formulas in the cells. When I click 'enable macros' the window apprears

for
each line of code.

???????????

"Christy" wrote:

Thanks JNW

I tried that but I don't where to put the CurDir? The link is a cell

formula
put in the cell via code.

The code puts a formula linking to the other workbook in a cell. The
procedure is ran on opening the workbook. When I open the file and chose
'update links' an "Update values" windows looking in MyDocuments opens
wanting me to point to the file. This will repeat thousands of times for

each
line of code.

I need the links to update without any input from the user.

Christy ;)



"JNW" wrote:

At the beginning of the code you can use the CurDir command to set the
current directory. That is if they are all in the same directory.

"Christy" wrote:

I have a workbook that will gather data from many other workbooks

via links.
the other workbooks will always be in the same folder as the

workbook
processing the links but I will not know the path of that folder.

I am putting the links in the cells via code like:

Range("b3").Formula = "='[62881.xls]Sheet1'!$B$4"

There are thousands of these links and when I run the code as is, it

wants
me to point to the file for each line. How can I set the path to

always be
in the current folder, wherever that folder is located?

Thanks in advance for any help
Christy ;)





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 extract only file name from folder path string in Excel? JayKay Excel Worksheet Functions 1 March 20th 09 04:57 PM
Launching an XL file gives errors for each folder in path, then opens PCLIVE Excel Discussion (Misc queries) 2 December 26th 07 09:11 PM
Save Linked Doc in Another Folder Without Changing Link Path jeannie v Excel Worksheet Functions 0 August 31st 06 05:48 PM
Find Folder Path + file Name Length and Insert into Spreadsheet Steve Roberts Excel Programming 1 July 26th 05 06:01 PM
Adding file name and path to to footer of all workbooks in a folder. Muxer[_2_] Excel Programming 2 April 9th 04 08:56 AM


All times are GMT +1. The time now is 11:31 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"