Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change workbook path in formula

I have several workbooks in c:\project\ named 'pr_A', 'pr_B', 'pr_C'...
they all have in common a worksheet 'total_data' where are several tables
that agregate the data in the remaining worksheets in the same workbook.
each project as a diferent way of agregate the information but all use the
same worksheet 'total_data'.
i have another workbook named 'main_project' that have also a workshet
total_data but in this case it goes to the file c:\project\pr_a.xls for the
data.
ex: formula in A8 := 'c:\project\[pr_a.xls]total_data'!A8
formula in B9 := 'c:\project\[pr_a.xls]total_data'!B9
(...)

i have the following sub

Public Sub change_file(ByVal actual_pr As String, ByVal new_pr As String)

Application.Workbooks.Open "c:\project\" + new_pr + ".xls"
Application.Calculate
Application.ActiveWorkbook.Close True
Sheet1.Range("A1:DZ250").Replace What:=actual_pr, Replacement:=new_pr,
SearchOrder:=xlByColumns, MatchCase:=True
Application.CalculateFull

End Sub

i wanted that 'main_project' could change its data "on-the-fly"
if i wanted to see project B i would do

change_file getname_actual_file(), "pr_b"
setname_actual_file "pr_b" ' saves the string in a worksheet cell

however each time an value its replaced it gives an error message (no quite
this because its in portuguese)
says the link was not updated because the "pr_b.xls" wasn't recalculated
last time it was saved. ok to update or cancel.

there are hundred or replacements :(

what i'm doing wrong ?
it's possible to answer yes to all by default?

p.s.:
calculation its set to manual because some external ad-ins, that are too
complex and if its automatic each time i make a change it take hours...


Thank You
Daniel
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
Formula Result Change when Workbook Sent by E-mail Rich F Excel Discussion (Misc queries) 4 September 4th 08 07:46 PM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
I have to change a bunch of formula that need to reference a different workbook. Marc Excel Worksheet Functions 5 July 19th 06 02:56 AM
how to change absolute path to relative path hwijgerse Excel Worksheet Functions 0 November 25th 05 07:18 AM
How to interpret a path to another workbook and use in formula bar hals_left Excel Programming 5 May 10th 04 10:21 AM


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