Public Function CreateFileFromResource(ByVal FilePath As String, _
ByVal ResID As Long, _ ByVal ResType As String) _ As Boolean 'This function returns False if LoadResData() fails (unlikely) 'It also does not check to see whether FilePath already exists 'or do much error checking of any kind for that matter :-) Dm hFile As Long Dim FileData() As Byte FileData = LoadResData(ResID, ResType) 'this loads your binary data On Error Resume Next 'stuck this here just so the prog won't 'crash if something goes wrong with LoadResData() If Len(FileData(1)) > 0 Then hFile = FreeFile() Open FilePath For Binary Access Write As #hFile Put #hFile, 1, FileData 'this writes your binary data Close #hFile CreateFileFromResource = True End If End Function |