Using basic maker, how do I open a worksheet and read two numbers from particular two cells.
Then write back to those cells new information?
I hope to run it from a planmaker button.
Regards Princy557

Code: Select all
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Application.Visible = True
Dim cell1, cell2 as String
'Read the value of A1 and A2 cells:
Set cell1 = pm.Application.Range("A1").Value
Set cell2 = pm.Application.Range("A2").Value
MsgBox(cell1 + " - " + cell2)
'Write new values in A1 and A2 cells:
pm.Application.Range("A1").Value = 10
pm.Application.Range("A2").Value = 20
Set pm = Nothing
Code: Select all
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Application.Visible = True
pm.Workbooks.Open("\Users\User\Desktop\Invoices.xlsx")
Dim today as Variant
today = pm.Application.Range("D1").Value 'D1 = Today()
For n = 1 to 1048576
If pm.Application.Range("B" & n).Value = "" Then
If n > 1 Then
pm.Application.Range("B" & n).Value = pm.Application.Range("B" & (n - 1)).Value + 1
Else
pm.Application.Range("B" & n).Value = 1
End If
'pm.Application.Range("A" & n).Value = Date() 'Type mismatch: Is this a bug?
pm.Application.Range("A" & n).Value = today
Exit For
End If
Next n