This is the code I've written thus far with not knowing if it is even close to what i need for a Macro. so any help or direction would be greatly appreciated. Thanking you in advance for any consideration.
Code: Select all
Option Explicit
Sub CalculateNetProfit
Dim oForm As Object
Dim oColumns As Object
Dim dAmount As Double
Dim dShippingCost As Double
Dim dFees As Double
Dim dBaseNetProfit As Double
Rem Gets Main internal form
oForm = ThisComponent.Drawpage.Forms.getByName(“MainForm”) ‘Get Form
Rem Check if textboxes have value
dAmount = oForm.getByName(“Amount”).getCurrentvalue()
dShippingCost = oForm.getByName(“Shipping Cost”).getCurrentValue()
dFees = oForm.getByName(“Fees”).getCurrentValue()
Rem Initial netprofit
dBaseNetProfit = 0.00
Rem Add NetProfit if value
if dAmount Then
dBaseNetProfit = dBaseAmount
End if
if dShippingCost Then
dBaseNetProfit = dBaseAmount – dBaseShippingCost
Else
dBaseNetProfit = dBaseAmount
End if
if dFees Then
dBaseNetProfit = dBaseAmount - dbaseShippingCost – dBaseFees
Else
dBaseNetProfit = dBaseAmount
End if
Rem Obtain and update NetProfit
oColumns = oForm.getColumns()
oColumns.getByName(“NetProfit”).updateDouble(dBaseNetProfit)
End Sub