Re: Please help me with TAB function...
VB Code:
Private Sub cmdtotal_Click()
Dim MyTotal As Single
Dim myTable As Table
Dim myCel As Cell
Set myTable = ActiveDocument.Tables(1)
Dim i As Integer
For i = 2 To myTable.Rows.Count '2 because you dont want to total the header
Set myCel = myTable.Rows(i).Cells.Item(5)
MyTotal = MyTotal + CSng(Replace(myCel.Range.Text, Chr(13) & Chr(7), ""))
Next
'Just as an example of how to display the total.
MsgBox "Total: " & MyTotal
End Sub
1 Attachment(s)
Re: Please help me with TAB function...
Hi,
It is works...But, why it did not doing anything (I mean calculate its total) until I move the form..???...In short, why I have to remove the form to get the total..???..Would you please have a look into my current updated file please which is I attached for you for your review...??? :)
Thanks a lot for your helps...
Jennifer ;)
Re: Please help me with TAB function...
Try a "Application.ScreenRefresh" after the total calculation. I couldnt get your latest version to actually run for some reason.
Re: Please help me with TAB function...
Hi,
I had tried this but still did not work.... :confused:
VB Code:
Private Sub cmdtotal_Click()
Dim MyTotal As Single
Dim myTable As Table
Dim myCel As Cell
Set myTable = ActiveDocument.Tables(1)
Dim i As Integer
For i = 2 To myTable.Rows.Count '2 because you dont want to total the header
Set myCel = myTable.Rows(i).Cells.Item(5)
MyTotal = MyTotal + CSng(Replace(myCel.Range.Text, Chr(13) & Chr(7), ""))
Next
Application.ScreenRefresh
ActiveDocument.FormFields("bkTotal").Result = MyTotal
End Sub
Re: Please help me with TAB function...
You have it backwards. Should be refreshing after the total is applied.
VB Code:
Private Sub cmdtotal_Click()
Dim MyTotal As Single
Dim myTable As Table
Dim myCel As Cell
Set myTable = ActiveDocument.Tables(1)
Dim i As Integer
For i = 2 To myTable.Rows.Count '2 because you dont want to total the header
Set myCel = myTable.Rows(i).Cells.Item(5)
MyTotal = MyTotal + CSng(Replace(myCel.Range.Text, Chr(13) & Chr(7), ""))
Next
ActiveDocument.FormFields("bkTotal").Result = MyTotal
Application.ScreenRefresh
End Sub
1 Attachment(s)
Re: Please help me with TAB function...
Hi,
It works..!!!...thanks a lot a lot a lot for your kind fully helps ;) :thumb:
I just wanna ask...why the file bit changed without action taken...Usually, when I open this file I can click "Display The Form" button on the word document template...But, now why when I click on this button the mouse icon did not changed into an arrow (which is ready to click sign)..???...Could you help for this please...???..
Please have a look into my finished file....(I have attached a file for your review).. :)
Thanks a lot,
Jennifer ;)
Re: Please help me with TAB function...
Yes, that hte issue I had with your previous attachment. Not sure why it wont get out of design mode.
Re: Please help me with TAB function...
Hi,
Thank you very much anyway for your kind helps...if you are not sure..I will ask in a new thread....is that all right..???
In addition, is that all right to post this issues and problem in the TUTORIAL so, everybody can learn how to make interactive invoice using VBA Words..???
Please let me know for this.... :)
Thank you so much for your kind helps....
All the best for you!!!
Jennifer ;)
Re: Please help me with TAB function...
Your Welcome :)
Basically the Tutorials section would require a reformatting of the concerned post(s) but yes if you'd like.
Yes, you can ask this new issue in a new thread to keep things segragated.
Ps, dont forget to 'Resolve' this thread then if your going to start the new issue in a new thread. ;)
Re: Please help me with TAB function...
How to put 'RESOLVE' to this thread..???
Re: Please help me with TAB function...
Go to the Thread Tools menu when viewing your thread and click the "Mark thread as Resolved". ;) :)