ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ±qtxt fileŪ¥Xbinary/hex data¡Aµ²§À«o¦h¥X¤@­Óbyte¬°0

[µo°Ý] ±qtxt fileŪ¥Xbinary/hex data¡Aµ²§À«o¦h¥X¤@­Óbyte¬°0

¦U¦ì¤j¤j­Ì§A¦n¡A½ÐÀ°¦£§ä¤@¤U°ÝÃD:
§Ú±qhello.txt file ­nŪ¥Xbinary/hex data¨ìexcel cells¡A
¦ý"hello"¥u¦³5­Óbyte¡A¥i¬O¥Î¥H¤Uµ{¦¡Åª¥X¨Ó·|¦A³Ì«á¦h¥X¤@­Óbyte¬°0?
¬Oµ{¦¡¼gªk­þ¸Ì¦³»~¶Ü?

----------------------------------------------------------------
Sub Temp1()

Application.ScreenUpdating = False

    Dim intFileNum%, bytTemp As Byte, intCellRow%
    intFileNum = FreeFile
    intCellRow = 0

    fipath = "C:\hello.txt"
   
    Open fipath For Binary Access Read As intFileNum

    Do While Not EOF(intFileNum)
        intCellRow = intCellRow + 1
        Get intFileNum, , bytTemp
        Cells(1, intCellRow) = Hex(bytTemp) '' convert dec to hex

    Loop
    Close intFileNum
   
Application.ScreenUpdating = True

MsgBox "Done."

End Sub
-------------------------------------------------------------------------------------------------

¦^´_ 4# quickfixer

³o¤]¬O­Ó¦n¤èªk¡A·PÁÂquickfixer¤j~

TOP

¦^´_ 3# swatt


    Sub Temp1()
    Dim intFileNum%, byttemp As Byte, intCellRow%, pos
    intFileNum = FreeFile
    intCellRow = 0
   
    fipath = "C:\hello.txt"
   
    Open fipath For Binary Access Read As intFileNum
   
    Do While pos < LOF(intFileNum)
        intCellRow = intCellRow + 1
        Get intFileNum, , byttemp
        pos = Loc(intFileNum)
        Cells(1, intCellRow) = Hex(byttemp)
    Loop
   
    Close intFileNum

MsgBox "Done."

End Sub

TOP

¥»©«³Ì«á¥Ñ swatt ©ó 2020-8-27 17:40 ½s¿è

¦^´_ 2# swatt

¥ý¶¸ôÁ×¹L³o­Ó°ÝÃD¡A¤£¥ÎEOF§ï¥Îfil size §PÂ_ÀÉ®×µ²§ô.
  1. Sub Temp1()

  2. Application.ScreenUpdating = False

  3.     Dim intFileNum%, bytTemp As Byte, intCellRow%
  4.     intFileNum = FreeFile
  5.     intCellRow = 1

  6.     fipath = "C:\hello.txt"
  7.    
  8.     flen = FileLen(fipath) 'get file length
  9.    
  10.     Open fipath For Binary Access Read As intFileNum

  11.     'Do While Not EOF(intFileNum) '¥ÎEOF§PÂ_·|¦bµ²§À¦h¥X¤@­Óbyte¬°0
  12.     Do While intCellRow <= flen
  13.                 Get intFileNum, , bytTemp
  14.         Cells(1, intCellRow) = Hex(bytTemp) '' convert dec to hex
  15.         intCellRow = intCellRow + 1
  16.     Loop
  17.     Close intFileNum
  18.    
  19. Application.ScreenUpdating = True

  20. MsgBox "Done."

  21. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# swatt

¸É¥R¤@¤U,¦¹µ{¦¡ªº¥Øªº¬O­n¥Hbyte¬°ªø«×,±N¥ô·NÀɮתº­ì©l½X(ASCII)¼g¨ìexcel,
°ò¥»¤Wµ{¦¡¬O¥i¦æªº¡A¦ý´N¬O¦b³Ì«á­±·|¦h¥X¤@­Óbyte¡A³o­Óbyte¤@©w¬O0,
§ä¤£¥X°ÝÃD¦b­þ¸Ì¡A½Ð¤j¤j­ÌÀ°¦£¤@¤U¡A·PÁÂ~
  1. Sub Temp1()

  2. Application.ScreenUpdating = False

  3.     Dim intFileNum%, bytTemp As Byte, intCellRow%
  4.     intFileNum = FreeFile
  5.     intCellRow = 0

  6.     fipath = "C:\hello.txt"
  7.    
  8.     Open fipath For Binary Access Read As intFileNum

  9.     Do While Not EOF(intFileNum)
  10.         intCellRow = intCellRow + 1
  11.         Get intFileNum, , bytTemp
  12.         Cells(1, intCellRow) = Hex(bytTemp) '' convert dec to hex

  13.     Loop
  14.     Close intFileNum
  15.    
  16. Application.ScreenUpdating = True

  17. MsgBox "Done."

  18. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : «Î¼e¤£¦p¤ß¼e¡C
ªð¦^¦Cªí ¤W¤@¥DÃD