Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Retrieving cell formatting from closed workbook


*Hey guys, I've studied C++ for a couple of years, but I am somewhat ne
to Excel VBA -- so I was wondering if you could help me out. Here's th
problem:

Currently, I have a GetValue function which pulls a cell's value from
closed workbook and an OutputData function which stores the value in th
corresponding cell of the active sheet, however the cell's formatting i
lost in the process. Is it possible to carry any of the cell'
formatting across and, if so, could someone advise me on how to d
this? In particular, what objects, classes, or functions might
need? Also, would a GetFormat function call from GetValue slow th
processing speed down much more than just passing more parameters t
the GetValue function?

Thanks. *

Private Function GetValue(path, file, sheet, ref)

Dim arg As String

arg = "'" & path & "[" & file & "]" & sheet & "'!"
Range(ref).Range("A1").address(, , xlR1C1)

GetValue = ExecuteExcel4Macro(arg)

End Function

Private Function OutputData(File, InputRow, OutputRow, FileDone)

p = PathName(File)
f = FileName(File)
s = "InputSheet"

Do

For c = 1 To 20
a = Cells(InputRow, c).address
Activesheet.Cells(OutputRow, c) = GetValue(p, f, s, a)
Next c

InputRow = InputRow + 1
If Not FileDone Then OutputRow = OutputRow + 1

Exit Do
Ignore = True
FileDone = True
Loop

End Functio

--
paulharve
-----------------------------------------------------------------------
paulharvey's Profile: http://www.excelforum.com/member.php...fo&userid=2522
View this thread: http://www.excelforum.com/showthread.php?threadid=38714

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Retrieving cell formatting from closed workbook

I'm pretty sure not possible, if it is no doubt someone will come back and
demonstrate. The potential XLM to use would be GET.CELL() which can return a
variety of cell details and most formats. But it does not appear to work
with a closed workbook, either in VBA with ExecuteExcel4Macro or in a named
formula.

Regards,
Peter T

"paulharvey" wrote
in message ...

*Hey guys, I've studied C++ for a couple of years, but I am somewhat new
to Excel VBA -- so I was wondering if you could help me out. Here's the
problem:

Currently, I have a GetValue function which pulls a cell's value from a
closed workbook and an OutputData function which stores the value in the
corresponding cell of the active sheet, however the cell's formatting is
lost in the process. Is it possible to carry any of the cell's
formatting across and, if so, could someone advise me on how to do
this? In particular, what objects, classes, or functions might I
need? Also, would a GetFormat function call from GetValue slow the
processing speed down much more than just passing more parameters to
the GetValue function?

Thanks. *

Private Function GetValue(path, file, sheet, ref)

Dim arg As String

arg = "'" & path & "[" & file & "]" & sheet & "'!" &
Range(ref).Range("A1").address(, , xlR1C1)

GetValue = ExecuteExcel4Macro(arg)

End Function

Private Function OutputData(File, InputRow, OutputRow, FileDone)

p = PathName(File)
f = FileName(File)
s = "InputSheet"

Do

For c = 1 To 20
a = Cells(InputRow, c).address
Activesheet.Cells(OutputRow, c) = GetValue(p, f, s, a)
Next c

InputRow = InputRow + 1
If Not FileDone Then OutputRow = OutputRow + 1

Exit Do
Ignore = True
FileDone = True
Loop

End Function


--
paulharvey
------------------------------------------------------------------------
paulharvey's Profile:

http://www.excelforum.com/member.php...o&userid=25227
View this thread: http://www.excelforum.com/showthread...hreadid=387144



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
Export cell data to closed workbook cluckers Excel Discussion (Misc queries) 7 July 23rd 09 08:43 PM
retrieving "unsaved" files that you accidentally closed? Bardia Excel Discussion (Misc queries) 1 August 25th 08 08:12 PM
Consolidation of data from cell in active sheet of closed workbook Neil X Peel Excel Worksheet Functions 3 March 8th 07 02:35 PM
Get value of last cell in column A from a closed workbook Jon Atkins Excel Programming 3 September 20th 04 08:43 PM
Linking to a cell in another (closed) workbook John Wirt[_6_] Excel Programming 6 May 12th 04 07:55 AM


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