Writing Bytes to a File using VBA

M

Mitthu.Gupta

Hello,


I am using a VBA code in power point. I need to write a byte array to a
file on the local system and save the file as a GIF. Could you please
guide me as to how i should go about this?

Thanks for all the help
Mitthu
 
K

Karl E. Peterson

I am using a VBA code in power point. I need to write a byte array to a
file on the local system and save the file as a GIF. Could you please
guide me as to how i should go about this?

Here's the general idea...

Private Function WriteFileB(ByVal FileName As String, Data() As Byte) As Boolean
Dim hFile As Long

' Since this is binary, we need to delete existing crud.
On Error Resume Next
Kill FileName

' Okay, now we just spit out what was given.
On Error GoTo Hell
hFile = FreeFile
Open FileName For Binary As #hFile
Put #hFile, , Data
Close #hFile
Hell:
WriteFileB = Not CBool(Err.Number)
End Function

Later... Karl
 
K

Klaus Linke

On Error GoTo Hell

Does that code work for secular progressives too?
And should you goto hell for an honest error?

;-) Klaus
 
K

Karl E. Peterson

Klaus Linke said:
Does that code work for secular progressives too?
And should you goto hell for an honest error?

;-) Klaus

Heheheh... It's really more a description of the current program state, at that
moment in time. <g>
 
K

Klaus Linke

On Error GoTo Hell
Heheheh... It's really more a description of the current program state,
at that moment in time. <g>

If you write code like that, don't complain when people move from VB(A) to
computer-agnostic languages like Java.

<g, d & r> Klaus
 

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