Page 2 of 2 FirstFirst 12
Results 41 to 51 of 51

Thread: [RESOLVED] Please help me with TAB function...

  1. #41
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Please help me with TAB function...

    VB Code:
    1. Private Sub cmdtotal_Click()
    2.  
    3.     Dim MyTotal As Single
    4.     Dim myTable As Table
    5.     Dim myCel As Cell
    6.     Set myTable = ActiveDocument.Tables(1)
    7.     Dim i As Integer
    8.     For i = 2 To myTable.Rows.Count '2 because you dont want to total the header
    9.         Set myCel = myTable.Rows(i).Cells.Item(5)
    10.         MyTotal = MyTotal + CSng(Replace(myCel.Range.Text, Chr(13) & Chr(7), ""))
    11.     Next
    12.     'Just as an example of how to display the total.
    13.     MsgBox "Total: " & MyTotal
    14.  
    15. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  2. #42

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    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
    Attached Files Attached Files

  3. #43
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #44

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: Please help me with TAB function...

    Hi,

    I had tried this but still did not work....

    VB Code:
    1. Private Sub cmdtotal_Click()
    2.  
    3.     Dim MyTotal As Single
    4.     Dim myTable As Table
    5.     Dim myCel As Cell
    6.     Set myTable = ActiveDocument.Tables(1)
    7.     Dim i As Integer
    8.     For i = 2 To myTable.Rows.Count '2 because you dont want to total the header
    9.         Set myCel = myTable.Rows(i).Cells.Item(5)
    10.         MyTotal = MyTotal + CSng(Replace(myCel.Range.Text, Chr(13) & Chr(7), ""))
    11.     Next
    12.    
    13.     Application.ScreenRefresh
    14.    
    15.     ActiveDocument.FormFields("bkTotal").Result = MyTotal
    16.  
    17. End Sub

  5. #45
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Please help me with TAB function...

    You have it backwards. Should be refreshing after the total is applied.
    VB Code:
    1. Private Sub cmdtotal_Click()
    2.  
    3.     Dim MyTotal As Single
    4.     Dim myTable As Table
    5.     Dim myCel As Cell
    6.     Set myTable = ActiveDocument.Tables(1)
    7.     Dim i As Integer
    8.     For i = 2 To myTable.Rows.Count '2 because you dont want to total the header
    9.         Set myCel = myTable.Rows(i).Cells.Item(5)
    10.         MyTotal = MyTotal + CSng(Replace(myCel.Range.Text, Chr(13) & Chr(7), ""))
    11.     Next
    12.    
    13.     ActiveDocument.FormFields("bkTotal").Result = MyTotal    
    14.    
    15.     Application.ScreenRefresh
    16.  
    17. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #46

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: Please help me with TAB function...

    Hi,

    It works..!!!...thanks a lot a lot a lot for your kind fully helps

    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
    Attached Files Attached Files

  7. #47
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #48

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    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

  9. #49
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #50

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: Please help me with TAB function...

    How to put 'RESOLVE' to this thread..???

  11. #51
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Please help me with TAB function...

    Go to the Thread Tools menu when viewing your thread and click the "Mark thread as Resolved".
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width