Results 1 to 11 of 11

Thread: Need help with basic VB application in Word

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Location
    central PA
    Posts
    5

    Resolved Need help with basic VB application in Word

    I am no programmer or even in the computer field, so bare with me here please. I was making a Word document for school and was tinkering with the VB that is accessible through Word. I made a textbox with a scroll bar in the middle of a one-page document.

    I have two problems with it. The scroll bar works great with that textbox until I close the file and then reopen it. That document always opens up in design mode which means I must exit design mode in order for the scroll bar to work. How do I change that so it opens with the VB scroll bar working?

    The second question has to do with scrolling the entire Word document. When I do that, the VB textbox does not move until the mouse is released. Anything I can do there?
    Thanks!
    Last edited by RobDog888; Feb 14th, 2005 at 07:07 PM.

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

    Re: Need help with basic VB application in Word

    Welcome to the Forums.

    Ok, you can use some code to set the mode when the document is opened.

    Second, I dont think that there is a way to fix this. What version of Word are
    you running?

    VB Code:
    1. Private Sub Document_Open()
    2.     If ActiveDocument.FormsDesign = True Then
    3.         ActiveDocument.ToggleFormsDesign
    4.     End If
    5. End Sub
    's on getting the correct forum to post your question. Most new members
    think that Word's VBA Editor is VB
    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
    New Member
    Join Date
    Feb 2005
    Location
    central PA
    Posts
    5

    Re: Need help with basic VB application in Word

    Thanks for the welcome. I'm using Word from Office 2000.

    I'll try what you have there.

    I can't say I've never messed with VB. I was a beginner programmer about 6 years ago with VB. I helped program user interfaces for industrial machinery that ran off PLC's. Whats sad is that I do not remember anything hardly, just enough to get in trouble.

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

    Re: Need help with basic VB application in Word

    I have a background in electronics and robotics so I know what you mean about the PLC's and I
    almost went into that field, but for some reason I didnt realize that I could make a career out of
    programming even though I had done it off and on for 10 years before that.

    If you need any help I am usually on-line a good portion of the day and night and dont worry, it
    will all come back to you.


    Ps, since your new, I'll mention that you should Resolve your thread when your question has been
    solved. Its kinda like a courtesy to others so they dont read the thread entirely to find out
    that its already been solved

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

    Re: Need help with basic VB application in Word

    Did you place the code in "ThisDocument" in the VBA Editor?
    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. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Need help with basic VB application in Word

    I attached a zipped copy of my test document. Make sure you are enabling
    macros to run when you open Word.
    Attached Files Attached Files
    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

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Location
    central PA
    Posts
    5

    Re: Need help with basic VB application in Word

    The code I have is like what you wrote and it is in the right place. I forgot all about macros. I used the help feature through Word just now and I think I created or enabled it. Not so sure though.

    Your test is a little different than mine. I have text entered in it for someone to read for example. I also activated a vertical scrollbar.

    If I figure out how to attach it here I'll do it.

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

    Re: Need help with basic VB application in Word

    You need to restart Work after you change the security macro level to medium. This will prompt
    you to choose if you want to enable macros or not.

    You can attach a file at the botom of a new reply where it says "Manage Attachments" button.

    Got to go.

    Later.
    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

  9. #9

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Location
    central PA
    Posts
    5

    Re: Need help with basic VB application in Word

    I think the problem is the macros not being enabled. I thought I was following the right steps when I went to macro in the toolbar window came up and I typed in AutoNew and followed a couple more steps and some new code appeared. If I try to run everything, I get an error saying macros not enabled.

    Heres the file hopefully and thanks for your help so far
    Attached Files Attached Files

  10. #10

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Location
    central PA
    Posts
    5

    Resolved Re: Need help with basic VB application in Word

    Looks like changing the macros security to medium did it. Thanks for your help Rob. You're allright, even for a Raider fan

    How bout them Steelers!

    Go ahead and lock this one up or resolve it.
    Last edited by Steelrat; Feb 14th, 2005 at 04:01 PM.

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

    Re: Need help with basic VB application in Word

    No prob. Glad to help.

    Ah, a Steeler fan I see. Better luck next year.

    Ps, I resolved the thread for you, but usually the thread starter should do it
    by editing the first post and either changing the subject icon to the green
    check mark or appending the subject with "[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

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