Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetInfoFromClosedFile proc 1

Status
Not open for further replies.

ClulessChris

IS-IT--Management
Jan 27, 2003
890
GB
Some time back I found and used the following function. Recently I've found that this will not copy all info from a given cell. i.e. is a cell holds large amounts of text only some of this will be collected by the function.

Can you suggest a fix or an alternative?

Code:
Private Function GetInfoFromClosedFile(ByVal wbPath As String, wbName As String, wsName As String, cellRef As String) As Variant
Dim arg As String
    GetInfoFromClosedFile = ""
    If Right(wbPath, 1) <> "\" Then wbPath = wbPath & "\"
    If Dir(wbPath & "\" & wbName) = "" Then Exit Function
    arg = "'" & wbPath & "[" & wbName & "]" & wsName & "'!" & Range(cellRef).Address(True, True, x1R1C1)
    On Error Resume Next
    GetInfoFromClosedFile = ExecuteExcel4Macro(arg)
End Function

Never knock on Death's door: ring the bell and run away! Death really hates that!
 
Probably to do with a character limit when transferring data between applications (which is what you are effectively doing using this method - that being the case it would be shown by only getting the 1st 1056 characters from a cell

Not sure if there is a way around this as Excel4Macros havn;t been updated in a looooong time and AFAIK they are the only way to get data from a closed file like this...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top