Ok
Word uses pages, so something else is causing a problem
The multipage1.enabled property has no effect (you can still enable or disable individual pages with no errors if the whole control is disabled)
can you give us some more background -
are there any objects or controls in the multipage control?
What versions of Word and the multipage control are you using?
from the error - doesn't support the property - i would suggest your syntax is incorrect, or you are passing a variable of the wrong type.
what is the syntax of the code you are trying?
I'm using Word XP and I was trying what you suggested above. I'm sure the syntax isn't quite right because I don't get the intellisense for the enabled property. I have a multipage control and I don't want the user to be able to go past the first tab until certain things are filled out. That's why I want to be able to control the enabled property of only certain pages through code. I'm attaching code to the click event of a next button that checks to see whether the required fields have been filled in. If they have been filled in then that is when i want the one tab to be enabled. I may have to think of another way to approach this. Thanks for your help thus far!!
I don't get the intellisense either for the enabled property.
This should work, I have done similar things in Excel with no real problems
Having no real Idea of your experience with VBA, I'll try to start from the simple things and work upwards, Please do not take offence...
What is the syntax that you are using. Are you using a variable to hold the page name or page number, i.e.
multipage1.pages(strPagename).enabled
or are you referencing it directly:
multipage1.pages("Page2".enabled
or multipage1.pages(2).enabled
can you read any properties? try pausing the code (put a breakpoint somewhere), then in the 'immediate' window type:
debug.print multipage1.pages(0).name
What is the output?
Where is the command button? is it in the multipage (i would assume it is, but I had better ask), or is it outside the control?
If it is in the multipage control, how are you trapping the click event of the button? - I ask because I have just set up something similar and I can't trap the event to test.
Can you enable or disable any of the pages, or is it just failing when you are doing it from the 'next' command button?
Are you disabling the page that the command button sits on ?
I must admit that
1)I hate VBA'ing in Word
2)I hate using the multipage control in VBA
they are both the devils spawn and man is not meant to wot of such things.
A much needed laugh after all this frustration Thanks!
I am referencing the page directly in code (as opposed to storing it in a variable). I am using the following:
multipage1.pages("PgGen".enabled
I also tried:
multipage1.pages(1).enabled
when debugging in the immediate mode the output was PgGen.
The command button actually sits on the userform below the multipage so that I will just have one button for navigation instead of one next button for each tabbed page (I will use select case statements based on the value of the page to determine what needs to be done for that specific page).
I tested putting a next button on the multipage itself and that didn't work either...
I'm not sure I know exactly what you mean for trapping the click event. When I test it, I commented out all the other code so that I just have the multipage.pages("PgGen".enabled in the click event, then I run the project and click on the button. That's when I get the error.
Thanks so much for helping me brainstorm on this one. I felt stupid posting because I was thinking "this seems like it should be so easy!". At least now I don't feel so bad!
Before I get much further, I have to say that it seems like it should be easy to me as well, and I have to admit to clutching at straws, but until any of the forums MVP's would like to step in and put us out of our misery, I would suggest that we keep on battling away.
What do we know:
you have a Multipage control on a form in WordXP
You have a command button on the form, from which you want to set the enabled property of individual pages.
You get output from debug.print, so the control is responding.
Thoughts:
I would suggest starting a fresh doc and putting a multipage and button on it, then trying to set the enabled property for pages as we have been from the command button click event (i.e. cut it down to the absolute basics)
If this works, then it would point to some other setting on your form that is causing problems
If it doesn't then there is something more fundamental at fault.
SteveO
P.S. can you confirm your level, I feel a bit silly in starting at the absolute basics - you might do this for a living, or you could be a 16 yr old doing homework
When I suggested starting from absolute basics, I honestly thought that that would work and we could build up from there.
As I said earlier,I am using word 2K, but I would assume that M$ would keep backwards compatability in word XP , so now the question is:
1) is your multipage control corrupt?
2) is the multipage control that you are using different from the one that I am using? (mine is called ' Microsoft forms 2.0 multipage')
3) is my assumption incorrect and The code won't work in Word XP?
Hold on... I've just re-read the thread to see if I missed anything. You say that the controls are on a userform. I didn't know that you could create a userform in Word (maybe it's an XP thing, maybe it's a gap in my knowledge)
here's a thought, have you tried referencing the control like:
me.userform1.multipage1....
This is a total stab in the dark, and I have to say that to go any further I think we need someone with Word XP to test the above - to see if there's a prooblem with your installation.
Is there another thread on this????? I seem to remember replying to another one just like this.
The syntax is multipagename.object.pagename.enabled = True/False
as in
MultiPage1.Object.Page1.Enabled=False will disable Page1 of the multipage named MultiPage1. Of course if this instruction is called from a different form, then you would have to do a fully qualified name - OtherForm.MultiPage1.Object.Page1.Enabled=False
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.