Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Link between files with vba

Hi all,
I have VB function that sums cells by the font color in my workbook an
I use this function on a linked file in this way:

=SumFontColor($A$1,'C:\LOGISTICS\A4\[NEW BOOKIN
SUMMARY.xls]N.BLDG'!E41)

For some reason all cells appear as "#value!" if the linked workbook i
closed
,if the linked workbook is opened all values appear as they should...


What am I doing wrong?

Please advise,
Thanks Yaron

p.s.

here is the above mentioned function:
Function SumFontColor(rFColor As Range, rFSumRange As Range)

Dim rFCell As Range
Dim iFCol As Integer
Dim vFResult

iFCol = rFColor.Font.ColorIndex

For Each rFCell In rFSumRange
If rFCell.Font.ColorIndex = iFCol Then
vFResult = WorksheetFunction.Sum(rFCell) + vFResult
End If
Next rFCell

SumFontColor = vFResult
End Functio

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Link between files with vba

VBA doesn't support accessing a closed workbook.

--
Regards,
Tom Ogilvy

"syaronc " wrote in message
...
Hi all,
I have VB function that sums cells by the font color in my workbook and
I use this function on a linked file in this way:

=SumFontColor($A$1,'C:\LOGISTICS\A4\[NEW BOOKING
SUMMARY.xls]N.BLDG'!E41)

For some reason all cells appear as "#value!" if the linked workbook is
closed
,if the linked workbook is opened all values appear as they should....


What am I doing wrong?

Please advise,
Thanks Yaron

p.s.

here is the above mentioned function:
Function SumFontColor(rFColor As Range, rFSumRange As Range)

Dim rFCell As Range
Dim iFCol As Integer
Dim vFResult

iFCol = rFColor.Font.ColorIndex

For Each rFCell In rFSumRange
If rFCell.Font.ColorIndex = iFCol Then
vFResult = WorksheetFunction.Sum(rFCell) + vFResult
End If
Next rFCell

SumFontColor = vFResult
End Function


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Link between files with vba

Do you have a creative idea how to bypass this problem ? in the secon
file i have money data that i don't want unothorized users to see...
Yaro

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Link between files with vba

Possibly treat your workbook as a database and use ADO

http://www.erlandsendata.no/english/...odao/index.php

However, I would suspect this would be slow if used in a worksheet function.

Perhaps you can do it using the old Excel 4 style macros.

--
Regards,
Tom Ogilvy

"syaronc " wrote in message
...
Do you have a creative idea how to bypass this problem ? in the second
file i have money data that i don't want unothorized users to see...
Yaron


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Link between files with vba

I had the same problem using DSUM. Is the reason the same?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Link between files with vba

Thanks for the help Tom,

can you please tell me what is "Excel 4 style macros" and where can
find them since i never heard about them,

Yaro

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Link between files with vba

any one with any good idea

--
Message posted from http://www.ExcelForum.com

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
Link 2 files Rich24 Excel Worksheet Functions 2 December 21st 09 05:40 AM
Link or Import another files Cam Excel Discussion (Misc queries) 0 October 14th 08 03:54 PM
how do i link multiple files (tif files) to one cell Kerry Excel Discussion (Misc queries) 0 July 31st 08 06:03 PM
break link of two files Miri Excel Discussion (Misc queries) 2 February 8th 07 07:06 PM
how do i link 2 excel files? Ben New Users to Excel 1 May 21st 05 01:11 PM


All times are GMT +1. The time now is 11:42 PM.

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"