I made a lot of gold investments and made profits but someone told me that buying and selling gold and making a profit is Haram. Does this mean I cannot purchase shares of a company which deals in gold production and selling?

There is no problem in such deals as long they are made correctly.