Results 1 to 16 of 16

Thread: MS Word (Solved)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Resolved MS Word (Solved)

    I am trying to figure out how to get ms word using the VB editor to tab through my textboxes. Word dose not give you the option to use the normal tab index property. Becouse, that is not a setting to change. can someone help me?
    Last edited by jmhfloor; Dec 3rd, 2004 at 04:41 PM.

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

    Are the textboxes on a userform or actually just on the document?
    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Question

    If we are talking about the same thing they are actually on the Document.

    I dont really know what you mean by user form.

    I opened a word document I went to Macro and went to VB editor
    from there I went to design view and created my document. Then went back to VB Editor to put in my code for what I need it to do.

    So with all that said I think it is on the document.

    I would attach one but it wont let me uplost .word files
    Last edited by jmhfloor; Dec 2nd, 2004 at 04:45 PM.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    It will if you zip it first.
    Yes, its on the document itself. If it was a userform it would look
    like a VB Form.

    Forums going down in a couple of minutes.
    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

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Re: MS Word tabing threw document

    ok so it is on the document. What do I do now? My Office Comp. dose not have a program to zip so I am going to try to DL one in the next few min.

    so it seems Guru that you know what I am talking about. Do you need the document to be able to help me or can you just post the code that I need?

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Re: MS Word tabing threw document

    hrm let me try something with this new version here. I got it I got it!!!! ok Now you have my file. I hope you can help me figure it out.
    Last edited by jmhfloor; Dec 3rd, 2004 at 04:30 PM.

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

    Re: MS Word tabing threw document

    Ok, solved it. Seems there is no support for TabIndex or tabbing. so I made my own. When the doc is opened the textboxes are set to allow the tab character to be placed into the textbox. This will allow us to trap for the tab keydown event.
    Code:
    Private Sub Document_Open()
        TextBox1.TabKeyBehavior = True
        TextBox2.TabKeyBehavior = True
        TextBox3.TabKeyBehavior = True
    End Sub
    
    Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        If KeyCode = 9 And Shift = 0 Then
            KeyCode = 0
            TextBox2.Select
        ElseIf KeyCode = 9 And Shift = 1 Then
            KeyCode = 0
            TextBox3.Select
        End If
    End Sub
    
    Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        If KeyCode = 9 And Shift = 0 Then
            KeyCode = 0
            TextBox3.Select
        ElseIf KeyCode = 9 And Shift = 1 Then
            KeyCode = 0
            TextBox1.Select
        End If
    End Sub
    
    Private Sub TextBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        If KeyCode = 9 And Shift = 0 Then
            KeyCode = 0
            TextBox1.Select
        ElseIf KeyCode = 9 And Shift = 1 Then
            KeyCode = 0
            TextBox2.Select
        End If
    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

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Exclamation Re: MS Word tabing threw document

    Awsome that works Great. one last question will the same code work for the combo boxes and check boxes?

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

    Re: MS Word tabing threw document

    Yes, but you need to add their respective events like I did for the textboxes. Also, update the order of control tabbing. The Tabbing is only supported when the textbox, for ex., is placed on a UserForm. If its on the document itself then its not supported.
    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. #10

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Exclamation Re: MS Word tabing threw document

    ok I got the tab through to work. I only have 1 last question. How do I put information in those drop down combo boxes?

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

    Re: MS Word tabing threw document

    I take it we are still talking on the document level. Probably in the Document_Open event you can load the cbo in there using something like...
    Code:
    Private Sub Document_Open()
        
        Dim i As Integer
        
        TextBox1.TabKeyBehavior = True
        TextBox2.TabKeyBehavior = True
        TextBox3.TabKeyBehavior = True
        
        For i = 1 To 10
            ComboBox1.AddItem "Test item " & i
        Next
        
    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

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Exclamation Re: MS Word tabing threw document

    hrm, I could not get that code to work?

    Yes we are still talking about the same form. however when I lick on combobox1 there is still nothing in there and I used your code

    Dim i As Integer

    TextBox1.TabKeyBehavior = True
    TextBox2.TabKeyBehavior = True
    TextBox3.TabKeyBehavior = True

    For i = 1 To 10
    ComboBox1.AddItem "Test item " & i
    Next

    End Sub

    I have all the tab threw working. it works GREAT! but now I just need these drop down boxes to have information allready in them. am I puting the code in the wrong spot? I put it with the other Textbox tab key statement?

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Exclamation Re: MS Word Combo Box drop down inputing info

    And is it possible to make it so when you tab threw the curser automaticly go to the far left side of the text box? I seems that where ever you last clicked in the box is where the tab automaticly goes and you have to either click the front or backspace to the front. Is there a way to do that. and if so that is all I need and this program will be finished!!1




    PS. Guru you are truly a Guru. You have saved my Hide!

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

    Re: MS Word Combo Box drop down inputing info

    It should be in the Document_Open event. This way when you open the
    document it will be already populated, unless the contents of the cbo are
    driven by some kind of input from the user.

    Also make sure that the combo your using is the same control name as in
    your code - "ComboBox1".

    you can make the cursor be at the begining of the textbox using the code - TextBox1.SelStart = 0.

    HTH
    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

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    128

    Resolved Re: MS Word Combo Box drop down inputing info

    I GOT IT!. Guru you are the man thanks for taking all the time to help me with this program!!!!!!!!!!!!!!!

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

    Re: MS Word (Solved)

    No prob. Glad to help and as most members know, I am an Office Automation Addict in addition to a VB Forumns Addict!

    's on project completion.
    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

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