Perhaps it's just me, but to me it is totally unclear what you actually want to do, and also what sort of machine you have, what you mean by VB codes and so on. I know what VB is, but do you mean Visual Basic or something else? VB for which sort of software? Is it Mach3 or something else, perhaps putting your own code together from scratch? I am not a "laser guy" but since you posted under Laser machines, I wonder what you will do with an ATC (Automatic Tool Changer) if you are building a laser cutter. Also, do you mean tool height (from the table or the work piece) or tool length (the actual length of the tool)? Try to structure your post and questions a bit better because we are not mind readers.

Anyway, tool height or tool length is measured from a reference point. It can be the table top or the actual work piece, the important part is that you have a Z zero point which is your reference. I don't know if that answers your questions, since I don't know what you are asking for. If you are looking for VB codes then the Internet is full of VB examples for Mach3, but again, I am not sure what you actually asking for.