Load dialog that is embedded in a LibreOffice Calc spreadsheet

I’m working on a series of macros that are embedded in a LibreOffice Calc spreadsheet for personal use. Some of those macros are supposed to load one of two dialogs that are embedded in the same spreadsheet.
The code for the two macros in question:

' Purchase Dialog
Sub DiagPurchase
pd = Tools.ModuleControls.LoadDialog("Standard", "PurchaseAmount")
End Sub

' Deposit Dialog
Sub DiagDeposit
dd = Tools.ModuleControls.LoadDialog("Standard", "DepositAmount")
End Sub

When I run them, they’re supposed to open those dialogs.
What actually happens is they throw “BASIC runtime error.
An exception occurred
Type: com.sun.star.container.NoSuchElementException
Message: .” and highlight

oLibDialog = oLib.GetByName(DialogName)

in the ModualControls thing in the Tools library.
How do I fix this?

Try this way:

pd = Tools.ModuleControls.LoadDialog("Standard", "PurchaseAmount", ThisComponent.DialogLibraries)

Or without Tools library:

Sub DiagPurchase2
  Dim pd
  pd = CreateUnoDialog(DialogLibraries.getByName("Standard").getByName("PurchaseAmount"))
End Sub

Thank you! The one that used the Tools library still threw an error, but the one that does not use the Tools library worked perfectly.