473,387 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do I Declare a Variable/Constant?

I am writing a set of macros to use in PowerPoint. One of the macros
asks the user to input a prefix. the code is shown below:
Sub Prefix()
ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Add(Index:=2,
Layout:=ppLayoutText).SlideIndex
ActiveWindow.Selection.SlideRange.Layout = ppLayoutBlank
Dim Message, Title, Default, MyValue
Message = "Enter Frame Number Prefix" ' Set prompt.
Title = "Frame Number Prefix" ' Set title.
Default = "0000" ' Set default.
' Display message, title, and default value.
MyPrefix = InputBox(Message, Title, Default)
End Sub
I want to use MyPrefix in another macro that asks the user to enter a
Framenumber as shown below:
Sub FrameNumber()
ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Add(Index:=2,
Layout:=ppLayoutText).SlideIndex
ActiveWindow.Selection.SlideRange.Layout = ppLayoutBlank
Dim Message, Title, Default, MyValue
Message = "Enter Frame Number" ' Set prompt.
Title = "Create Frame Number" ' Set title.
Default = "ABC 0000" ' Set default.
' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)
ActiveWindow.Selection.SlideRange.Shapes.AddLabel( msoTextOrientationHorizon*tal,

293.75, 66.625, 14.5, 18).Select
ActiveWindow.Selection.ShapeRange.TextFrame.WordWr ap = msoFalse
With ActiveWindow.Selection.TextRange.ParagraphFormat
.LineRuleWithin = msoTrue
.SpaceWithin = 1
.LineRuleBefore = msoTrue
.SpaceBefore = 0.5
.LineRuleAfter = msoTrue
.SpaceAfter = 0
End With
With ActiveWindow.Selection.ShapeRange
.Fill.ForeColor.RGB = RGB(237, 246, 247)
.Fill.Visible = msoTrue
.Fill.Solid
End With
With ActiveWindow.Selection.ShapeRange
.Line.ForeColor.RGB = RGB(255, 255, 102)
.Line.Visible = msoTrue
End With
ActiveWindow.Selection.ShapeRange.IncrementLeft -135#
ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge.Font.Size =
12
ActiveWindow.Selection.ShapeRange.TextFrame.TextRa nge.Characters(Start:=1,

Length:=0).Select
MyText = "Frame # "
TotalText = MyText + MyPrefix + MyValue
With ActiveWindow.Selection.TextRange
.Text = TotalText
With .Font
.Name = "Arial"
.Size = 12
.Bold = msoFalse
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppForeground
End With
End With
End Sub
How do I get MyPrefix to be defined as a public constant (or variable)
so once MyPrefix is entered it will be picked up and used by
Framenumber each time framenumber is run?
Thanks,
Dennis

Nov 21 '05 #1
1 1877
Problem solved. Added the following to the project level:

Public MyPrefix As String

Dennis

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: NotGiven | last post by:
I have an file I call using: require_once() In this file I have variables I'd like to use in the calling page and functions called by that page. How can I do this? example:
20
by: CoolPint | last post by:
While I was reading about const_cast, I got curious and wanted to know if I could modify a constant variable through a pointer which has been "const_cast"ed. Since the pointer would be pointing to...
7
by: icosahedron | last post by:
Is there a way to determine if a parameter to a function is a constant (e.g. 2.0f) versus a variable? Is there some way to determine if this is the case? (Say some metaprogramming tip or type...
8
by: redefined.horizons | last post by:
I would like to have an array declaration where the size of the array is dependent on a variable. Something like this: /* Store the desired size of the array in a variable named "array_size". */...
5
by: sharat | last post by:
hi all can any body tell how to declare the structure pointer within a class. i have written the following program but gettin error. #include<iostream> using namespace std;
3
by: johnmmcparland | last post by:
Hi all, I would like to have a static constant array inside a class definition which would contain the number of days in each month (I am writing a Date class as an exercise). However my...
3
pentahari
by: pentahari | last post by:
My function is: Function test(optional ByVal arr1() as System.Array) End Function how to declare the array as optional? i know that optional variable must be constant value, but i don't...
13
by: bobg.hahc | last post by:
running access 2k; And before anything else is said - "Yes, Virginia, I know you can NOT use a variable to set a constant (that's why it's constant)". BUT - my problem is - I want a constant,...
3
by: Andrea Raimondi | last post by:
Hello peers! I'm working on this application and I'm in need for some thoughtful advice :-p I have an SQLDataSource with params, select, etc. One of my params is the table name, which can be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.