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!
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:
Private Sub Document_Open()
If ActiveDocument.FormsDesign = True Then
ActiveDocument.ToggleFormsDesign
End If
End Sub
:thumb:'s on getting the correct forum to post your question. Most new members
think that Word's VBA Editor is VB ;)
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.
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. :blush:
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 :thumb:
Re: Need help with basic VB application in Word
Did you place the code in "ThisDocument" in the VBA Editor?
1 Attachment(s)
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.
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.
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.
1 Attachment(s)
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
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 :D
How bout them Steelers!
Go ahead and lock this one up or resolve it.
Re: Need help with basic VB application in Word
No prob. Glad to help. :thumb:
Ah, a Steeler fan I see. Better luck next year. :p
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]"