Exhibit 5 OPINION OF PRESTON GATES & ELLIS LLP July 22, 1997 Microsoft Corporation One Microsoft Way Redmond, WA 98052 Re: Registration Statement on Form S-3 ---------------------------------- Ladies and Gentleman: In connection with the registration of 154,898 shares of common stock, par value $.000025 per share (the "Common Shares") of Microsoft Corporation (the "Company") with the Securities and Exchange Commission on a Registration Statement on Form S-3 (the "Registration Statement"), relating to the sales, if any, of the Common Shares by the selling shareholders, we have examined such documents, records and matters of law as we have considered relevant. Based upon such examination and upon our familiarity as counsel for the Company with its general affairs, it is our opinion that: The Common Shares being registered are legally issued, fully paid, and nonassessable. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement. Very truly yours, Preston Gates & Ellis LLP /s/ Mark R. Beatty By Mark R. Beatty