when to use hereby
Hereby is used in connection with what is present with the speaker or what the speaker has just mentioned or the speaker's present words (i.e. the present document); thereby is used in connection with what is at a distance from the speaker or what has been mentioned by the speaker or by someone else.