Ma "gg" è una stringa?

Perchè se così fosse hai dimenticato l'apicetto...

("SELECT distinct sottocat from prodotti where macrocat = '" & gg & "' ")

Ciao.

P.S. Forse non è quello il problema, ma si curamente quello è un errore.