![]() |
|
#8
|
|||
|
|||
|
"I would have to create seperate Modules in the VBA window of the presentation?"
Probably not. In 2010 you can name each shape in the selection pane (from the HOME Tab > Select on the right)say you named them Current totalResistance etc Code:
Sub UpdateRandomNumber()
Dim Randval As Long
Dim current As Single
Dim voltDrop1 As Single
Dim voltDrop2 As Single
Dim ResTotal As Single
Dim osld As Slide
Randval = Random(1000, 10)
ResTotal = Randval + 100
current = 120 / ResTotal
voltDrop1 = current * Randval
voltDrop2 = current * 100
Set osld = SlideShowWindows(1).View.Slide 'The current slide
osld.Shapes("Current").TextFrame.TextRange = "The current is = " & CStr(current)
osld.Shapes("totalResistance").TextFrame.TextRange = "The total resistance is = " & CStr(ResTotal)
'etc
End Sub
Function Random(High As Long, Low As Long) As Long
Randomize
Random = Int((High - (Low - 1)) * Rnd) + Low
End Function
I used the type SINGLE for my variables. This is just in case you had decimal results. In your case I don't think that's possible and you could use LONG. osld is an OBJECT variable (in this case a slide) With object variables you must use the SET word you cannot say osld=SlideShowWindows(1).View.Slide Cstr converts a number to text PowerPoint will usually do this for you and many people regard the Cstr as not needed. I would always use it. I don't trust usually (well not usually) |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Macro to recap data of same numbers | Jasa P | Word VBA | 0 | 06-28-2012 02:41 AM |
Formatting changing randomly
|
Franuzz | Word | 1 | 07-14-2011 04:12 PM |
| black text randomly changing to white when run macro | G DeBree | PowerPoint | 0 | 03-16-2011 09:23 AM |
| Randomly delayed emails | Colinest84 | Outlook | 1 | 01-14-2011 02:32 AM |
| Documents Randomly Corrupting | the IT Guy | Word | 0 | 02-06-2009 09:11 AM |