ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how can i output the file (https://www.excelbanter.com/excel-programming/381819-how-can-i-output-file.html)

[email protected]

how can i output the file
 
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


NickHK

how can i output the file
 
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

wrote in message
ups.com...
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





All times are GMT +1. The time now is 02:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com