我怎么能读取使用VBA的二进制文件? [英] how can I read a binary file using VBA?

查看:1360
本文介绍了我怎么能读取使用VBA的二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有起因于写入康柏视觉的Fortran程序的二进制文件。
我怎样才能读取特定行并将它们保存在一个Excel工作表?

I have a binary file that resulted from a program written in Compaq Visual Fortran. How can I read specific lines and save them in an Excel sheet?

推荐答案

您必须使用二进制访问将其打开。

You have to open it using "Binary Access".

请参阅http://www.vbforums.com/showthread.php?t=430424

Sub Temp()
    Dim intFileNum%, bytTemp As Byte, intCellRow%
    intFileNum = FreeFile
    intCellRow = 0
    Open "C:\temp.bin" For Binary Access Read As intFileNum
    Do While Not EOF(intFileNum)
        intCellRow = intCellRow + 1
        Get intFileNum, , bytTemp
        Cells(intCellRow, 1) = bytTemp
    Loop
    Close intFileNum
End Sub

这篇关于我怎么能读取使用VBA的二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆