VBA Get textbox value

S

sanj

Hi,

Is this possible:

Slide one has 30 textboxes, I would like to create an array

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

when the user selects a textbox I would like to above macro to get the value
of the textbox and open the corresponding file - is this possible?

Thanks,

Sanj
 
D

David M. Marcovitz

Are these Active X text boxes created with the control toolbox, or are
they standard textboxes created with the drawing tools? If it is the
latter, you can tell which text box was clicked by assigning a parameter
to the macro that all the textboxes run. Example 8.10 on my site
demonstrates this:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on "Examples by Chapter" and "Chapter 8" to find the example.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
S

sanj

David,

I've checked your examples, its almost what I am looking for except I would
like to get the value/contents of the selected (clicked) textbox then use
the array to open a document:

if value/contents of selected textbox is val10 open a.xls

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

Regards,

Sanj



David M. Marcovitz said:
Are these Active X text boxes created with the control toolbox, or are
they standard textboxes created with the drawing tools? If it is the
latter, you can tell which text box was clicked by assigning a parameter
to the macro that all the textboxes run. Example 8.10 on my site
demonstrates this:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on "Examples by Chapter" and "Chapter 8" to find the example.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/

Hi,

Is this possible:

Slide one has 30 textboxes, I would like to create an array

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

when the user selects a textbox I would like to above macro to get the
value of the textbox and open the corresponding file - is this
possible?

Thanks,

Sanj
 
S

sanj

Sorry David,

I looked at your other example, Example08-10 this is much closer to what I
need, is it possible to use an array or do I need to use the IF/ELSE
statement?

Regards,

Sanj


sanj said:
David,

I've checked your examples, its almost what I am looking for except I would
like to get the value/contents of the selected (clicked) textbox then use
the array to open a document:

if value/contents of selected textbox is val10 open a.xls

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

Regards,

Sanj



David M. Marcovitz said:
Are these Active X text boxes created with the control toolbox, or are
they standard textboxes created with the drawing tools? If it is the
latter, you can tell which text box was clicked by assigning a parameter
to the macro that all the textboxes run. Example 8.10 on my site
demonstrates this:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on "Examples by Chapter" and "Chapter 8" to find the example.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/

Hi,

Is this possible:

Slide one has 30 textboxes, I would like to create an array

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

when the user selects a textbox I would like to above macro to get the
value of the textbox and open the corresponding file - is this
possible?

Thanks,

Sanj
 
A

Austin Myers

Instead of IF/ELSE try using "Select Case" Much simpler to write and will
execute MUCH faster.

Austin Myers
MS PowerPoint MVP Team

PowerPoint Video and PowerPoint Sound Solutions www.pfcmedia.com



sanj said:
Sorry David,

I looked at your other example, Example08-10 this is much closer to what I
need, is it possible to use an array or do I need to use the IF/ELSE
statement?

Regards,

Sanj


sanj said:
David,

I've checked your examples, its almost what I am looking for except I would
like to get the value/contents of the selected (clicked) textbox then use
the array to open a document:

if value/contents of selected textbox is val10 open a.xls

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

Regards,

Sanj



David M. Marcovitz said:
Are these Active X text boxes created with the control toolbox, or are
they standard textboxes created with the drawing tools? If it is the
latter, you can tell which text box was clicked by assigning a parameter
to the macro that all the textboxes run. Example 8.10 on my site
demonstrates this:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on "Examples by Chapter" and "Chapter 8" to find the example.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/


Hi,

Is this possible:

Slide one has 30 textboxes, I would like to create an array

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

when the user selects a textbox I would like to above macro to get the
value of the textbox and open the corresponding file - is this
possible?

Thanks,

Sanj
 
D

David M. Marcovitz

Yes, for 30 different options, a Select Case is probably better. There's
probably a data structure that can do what you want more cleanly, but I
don't know how to do it in VBA. What is the appeal of the array? You
would have to load the array and then access the contents of the array.
The Select Case (or the If/Else) would probably be about the same amount
of code.
--David

Instead of IF/ELSE try using "Select Case" Much simpler to write and
will execute MUCH faster.

Austin Myers
MS PowerPoint MVP Team

PowerPoint Video and PowerPoint Sound Solutions www.pfcmedia.com



sanj said:
Sorry David,

I looked at your other example, Example08-10 this is much closer to
what I need, is it possible to use an array or do I need to use the
IF/ELSE statement?

Regards,

Sanj


sanj said:
David,

I've checked your examples, its almost what I am looking for except
I would
like to get the value/contents of the selected (clicked) textbox
then use
the array to open a document:

if value/contents of selected textbox is val10 open a.xls

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

Regards,

Sanj



Are these Active X text boxes created with the control toolbox,
or are they standard textboxes created with the drawing tools? If
it is the latter, you can tell which text box was clicked by
assigning a parameter
to the macro that all the textboxes run. Example 8.10 on my site
demonstrates this:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on "Examples by Chapter" and "Chapter 8" to find the
example.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/


Hi,

Is this possible:

Slide one has 30 textboxes, I would like to create an array

myArr = [
val10, a.xls
val11, b.xls
val12, c.doc
val13, d.pdf
]

when the user selects a textbox I would like to above macro to
get the
value of the textbox and open the corresponding file - is this
possible?

Thanks,

Sanj
 

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