i have this saving as binary

is there some way to make this detect what kind of file it has and save it in the format that it is suposed to

like if its a binary file save it as binary
and if its a ascci save it as ascci


Open strfix & fname(UBound(fname)) For Binary Access _
Write As #1
Put #1, , b()
Close #1