Userform and Global Variable....

V

Vit @ OZ

Hi,
I’d like to set up a userform (or something similar), where I can set
up a choose (A,B,C,D,E) and store the choose on a global variable...
I’d like use this to perform automatically cost analysis (A,B,C,D,E
will be the five different cost tab on the resource rate table, and
with a different macro I will automatically perform some costs
analysis between the choose and the standard one (the A choose...)
Here you are the steps that I have followed:
- Open Project Professional (2007)
- Open VBA
- Insert a userform ( SetCost)
- Insert a frame (SellCostFrame)
- Insert 5 OptionButton (SellCostA, SellCostB, SellCostC, SellCostD,
SellCostE)
- Insert a CommandButton (Apply)
Now, what I have to do???
How I will open the user form from Project Professional??
How I fill force a Single Selection?
Where I will Store The Selection?
Thanks to everybody

Vit
 
J

Jack Dahlgren

Comments in line below:
Now, what I have to do???
Finish writing the code for the form.
How I will open the user form from Project Professional??

Insert a module. In the module write a macro which shows the form.

Sub showSetCost()
setcost.show
end sub

You can then assign the macro to a command bar button or just run it from
the macros list.
How I fill force a Single Selection?

Write some code which will set the value of the other selections to false
when the selection is chosen. Here is an example with three radio buttons:

Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
OptionButton2.Value = False
OptionButton3.Value = False
End If
End Sub

Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
OptionButton1.Value = False
OptionButton3.Value = False
End If
End Sub

Private Sub OptionButton3_Click()
If OptionButton3.Value = True Then
OptionButton1.Value = False
OptionButton2.Value = False
End If
End Sub
Where I will Store The Selection?

No need to store it as you can determine it at any time.
 
V

Vit @ OZ

That's great!!!! it works OK!!!!!!!!!!

only a question...

Jack Dahlgren said:
No need to store it as you can determine it at any time.

I have not undertand this point....

here you are the process that I'd loke to "run"

the first time I open a new file I have to set up a value of "OptionButton"
(A, B, C, D or E)...

the choose should be stored somewhere, so the next time I will open the
file, I will have the option already done...

I don't know if I have to store on a global variable ot on a custom field
(project level...)

please let me know

thanks

vit
 
J

Jack Dahlgren

If you want the value to be persistent you can store it in the project file
(perhaps in a text field or somewhere) or in a registry entry or in a
configuration file.

I'd just have it set blank at the start. That way you are certain that
people have actually chosen the value that they want.

-Jack Dahlgren
 
V

Vit @ OZ

perfect, it seems to be a good solution...

but, how I can write by VBA tha value of a custom project field?

thanks

Vit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top