getting Array Value within a User Form on a Button Click

lonely

Board Regular
Joined
Feb 28, 2003
Messages
230
Hi All,
I am working on a small VBA for PowerPoint.
I am trying to call the value of a array within a user form when a person clikc on a button. The code I am using is as shown below:
Code:
Public Sub MyButton_Click()
On Error Resume Next
With ActiveWindow.View.Slide.Tags
    .Add Name:="MYTAG", Value:= TagsArray(1)
End With
End Sub

However, when I compile the project, I get an error saying TagsArray function has not been defined. Please can someone help me with this?
Thanks,
Lonely
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi,
Thanks for the reply. The array is declared on the form initialize event. And althoguh it was Private earlier, i changed it to Public to see if it makes any difference.
 
Upvote 0
Hello again,

Declared or populated?

It can't be declared in a Form, delcare it publicly in a normal module. Now all modules across your project can see it.

Here's an example, all in a normal module:

Code:
Public myArr(0 To 1) As String

Sub testStck()
Let myArr(0) = "Test"
End Sub

Sub test()
MsgBox myArr(0)
End Sub
 
Upvote 0
Resolved!

Thanks a Lot NateO,
That helped me a lot...now i understand Arrays better.
Have a wonderful day!
 
Upvote 0

Forum statistics

Threads
1,224,853
Messages
6,181,414
Members
453,038
Latest member
muhsen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top