LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 97
Default SOS! Help! Loading another workbook in the current workbook - cellsnot updating!

SOS! Help! Loading another workbook in the current workbook - cells
not updating!

Hi all,

Please help me. I have spent quite a few days on this but couldn't get
it work.

On Excel file A.xls, I have 5 file names(Excel files) in A1 to A5 on
"sheet1"... and in that A.xls file I have the following VBA code.

The goal is to load the 5 Excel files one by one, and freeze all the
sheets therein. i.e. copy and pastespecial as values with formatting
and color etc.

That's to say, the goal is to take static snapshots of the dynamically
changing cells and sheets.

Each sheet have cells that are dynamically linked to external data-
source. And the data-source is real-time ticking.

Ideally, when I open those Excel files, the cells should show real-
time ticking numerical values upon refreshing and updating...

However, when I open those Excel files from within A.xls, non of the
cells got updated and therefore, the "frozen" values are all
"#VALUE!"...

[

I also run the following code in debugging mode. During the period
when the code is running, the newly opened sheets never got updated
and the values are all "#VALUE!",

but as soon as the debugging mode exits, the numbers are updating
realtime ticking...

therefore the problem is: if I do everything manually, the numbers are
ticking; but if I do it programmatically, the numbers aren't ticking
and updating...

]
What's the problem? Please help me!

------------------------------------------


Public Sub CopyAndFreezeSheets()
Dim WBsrc As Workbook
Dim WBthis As Workbook
Dim WSthis As Worksheet
Dim i As Integer
Dim strFileName As String
Dim wsSheet As Worksheet

Dim WSsrc As Worksheet

'Set WBsrc = Workbooks.Open("c:\Program Files\blp\API\Office Tools
\blpxladdin.xll")
'WBsrc.RunAutoMacros 1


Set WBthis = ThisWorkbook

Set WSthis = WBthis.Sheets("sheet1")

For i = 1 To 5



WBthis.Activate
WSthis.Activate
strFileName = WSthis.Range("A" + CStr(i)).Value
Set WBsrc = Workbooks.Open(strFileName, False)
Application.CalculateFull

Set WBsrc = ActiveWorkbook

'Application.Run "BLPLinkReset"

For Each wsSheet In WBsrc.Sheets

wsSheet.Activate
wsSheet.Calculate
wsSheet.UsedRange.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False

Next

WBsrc.Save
WBsrc.Close


Next


End Sub
 
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
Open New Workbook / Save and Close Current Workbook Joe K. Excel Programming 1 December 7th 07 08:04 PM
Place code from current workbook to new workbook Qaspec Excel Programming 5 June 8th 05 04:12 AM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM
Transparently updating another workbook from the current workbook lothario[_40_] Excel Programming 3 November 2nd 03 01:58 AM


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