Hey all,
So, I've got this function that is supposed to just set pass a StdFont variable, after setting it's arguments from data in some arrays.
VB Code:
  1. Private Function getGeneralFontData(intSectionIndex As Integer, intSizePosition As Integer) as StdFont
  2.  
  3. Dim sFnt As New StdFont
  4. sFnt.Size = garrChequePrinterCfg(intSectionIndex, intSizePosition) * 2
  5. sFnt.Name = garrChequePrinterCfg(intSectionIndex, intSizePosition + 1)
  6. If garrChequePrinterCfg(intSectionIndex, intSizePosition + 2) = "Yes" Then
  7.     sFnt.Bold = True
  8. Else
  9.     sFnt.Bold = False
  10. End If
  11. getGeneralFontData = sFnt
However, when I attempt to execute this funtion, I get the following error:
Run-time error '91':
Object variable or With block not set
(this is making a reference to the line getGeneralFontData = sFnt)

I thought that I set getGeneralFontData when I declared the function? When I remover the "as StdFont" part, the function actually seems to work, except for some reason the first time the function executes the values are passed incorrectly.
Thoughts?