开发者

Microsoft office Macro - Why is the document jumping around?

This if the first time I write a Microsoft Office Macro.

Basically, we have a few check boxes on page 1 and when one of them is checked, I need to auto-fill a text box on page 10 depending on which check box was checked. So each checkbox "on Entry" runs a macro.

Say the options are "Outstanding", "Exceeded" and "Unsatisfactory". When "Outstanding" is checked, that text box will be filled with "O", when "Exceeded" is checked, the text box will be filled with "E"

So the issue right now is, whenever I check the check box on page 1, suddenly, the document will jump to Page 10.

All I did was doing something like

oFFld("Text23").Result = "O"

I need it to stay on the same page! If I got rid of the above code, setting a value to the textbox, then nothing happens and I will stay on page 1.

What's going on? Any advice is greatly appreciated it.

ps:

开发者_JS百科

it's word 2007


Never mind.

I was using an evaluation expression as in

If OFFld("Text23").Result = "blah" Then

whenever I do that, it'll jump to the page 10. Took care of it in another way. solved.


See answer in Suppress unwanted jumping/scrolling on Word 2013 VBA Script for details, but essentially you want to use the Bookmark object rather than the FormField object to access the result property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜