how can i output the file

G

gongdayouzi

there is a txt file object in the excel file
(insert -> object -> create from file)

how can i read the txt file's contents or save the file?


thanks for method and advices
 
N

NickHK

I seem to remember some code posted, about the middle of last year, here,
for extracting embedded files (from Peter T ?), but can't find the link now.
Maybe this will point you in the right direction. This opens the text file
in the default app for that file type. Not really tested, but seems to work
for text files:

Private Sub CommandButton1_Click()
Dim EmbedObj As OLEObject

For Each EmbedObj In ActiveSheet.OLEObjects
With EmbedObj
'See if it is Embedded
If .OLEType = xlOLEEmbed Then
Select Case .progID
'Check the type
Case "Package"
'.Verb xlVerbOpen
.Verb xlVerbPrimary
Case Else
'Not dealt with
End Select
Else
'Linked. Get the filename ?
End If
End With
Next

End Sub

If you are feeling adventurous, this looks like the C++ (?) source code to
read such objects from the XL file:
http://pldaniels.com/ripole/


NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top