How to use com.sun.star.drawing.GradientTable in Basic?

How to use the service “com.sun.star.drawing.GradientTable”? The following results Null.

dim oServiceManager
oServiceManager = GetProcessServiceManager()
dim aGradientTable
aGradientTable = oServiceManager.CreateInstance("com.sun.star.drawing.GradientTable")

Same for

dim aGradientTable
aGradientTable = CreateUnoService("com.sun.star.drawing.GradientTable")

Exactly… what do you want to do?

Through an instance of the Draw document:

aGradientTable = ThisComponent.CreateInstance("com.sun.star.drawing.GradientTable")

The GradientTable is a sequence of the gradients available in the document. I want to create a new gradient, add it to the GradientTable and then use it for a shape. To use a gradient for a shape the gradient needs to be in the GradientTable, then you assign the name of the gradient to the property FillGradientName and set the FillStyle property to GRADIENT.

Thank you, that works.
I had tried

dim oDoc as object: oDoc = ThisComponent
dim aGradientTable
aGradientTable = oDoc.CreateInstance("com.sun.star.drawing.GradientTable")

and that does not work.
Do you know why it does not work?

Your version works for me. I use the as Object declaration if the variables are intended for objects:

Option Explicit
Sub Test
  Dim oDoc as Object: oDoc = ThisComponent
  Dim aGradientTable As Object
  aGradientTable = oDoc.CreateInstance("com.sun.star.drawing.GradientTable")
End Sub  

LO 7.4.2.3 Win 10.

Indeed. Then the difference is ‘variant’ vs. ‘object’. Thank you