I'm having problems using this method i've followed all the instructions in the sdk documentation on making sure your resource id's are strings etc but i get an error every time

Below is the source for my function:

Public Function TileFromRes(FileName As String, ResID As String) As DirectDrawSurface7

Dim TSDESC As DDSURFACEDESC2
Dim TempSurf As DirectDrawSurface7

With TSDESC
.lFlags = DDSD_CAPS + DDSD_HEIGHT + DDSD_WIDTH
.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
.lWidth = 32
.lHeight = 32
End With

Set TileFromRes = objDD.CreateSurfaceFromResource(FileName, ResID, TSDESC)

End Function