Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Greek Letters in Modules

Status
Not open for further replies.

FM1

Structural
Dec 16, 2001
67
hi,

I am looking for help on 2 issues and will appreciate any input.

1--I have a macro which results in displaying a mathematical expression(string) in a cell using some of the string and text functions. How can Greek symbols such as PI or PHI be included within the module functions so they end up in the final expressions? or can it be done at all?

2--How can a single module be protected or hidden by assigning a password.

Thanks.
 
Replies continue below

Recommended for you

For what application and what language are you refering to?

TTFN
 
Hi FM1!
about your #1, try this macro.
It reads from cell B2 a circle diameter (e.g. B2 value= 1.5) and writes in B3 its area expliciting PI.
Also it writes in B5 a sentence using mixed Arial and GreekC font (of course you can specify a different one).

Hope it helps.

_LF

Sub GreekInCell()
'
'
Range("B3").Select
ActiveCell.FormulaR1C1 = Str(Range("B2").Value ^ 2) & "*p/4"
N% = Len(Range("B3"))
With ActiveCell.Characters(Start:=N% - 2, Length:=1).Font
.Name = "GreekC"
.FontStyle = "Regular"
End With
Range("B5").Select
DD$ = "First letters of Greek alphabet are: ": U% = Len(DD$) + 1
DD$ = DD$ + "a(alpha), ": D% = Len(DD$) + 1
DD$ = DD$ + "b (beta), ": T% = Len(DD$) + 1
DD$ = DD$ + "g (gamma)"
ActiveCell.FormulaR1C1 = DD$
With ActiveCell
.Characters(Start:=U%, Length:=1).Font.Name = "GreekC"
.Characters(Start:=D%, Length:=1).Font.Name = "GreekC"
.Characters(Start:=T%, Length:=1).Font.Name = "GreekC"
End With

End Sub
 
You can get some symbols directly by holding down the Alt key and typing the 4 digit code for the symbol. This only works for symbols in the extended character set.
e.g type [Alt] + 0248 to get ø.
Check what's available in the character map.
 
answer for #2:

from within the vba module, select Tools - VBAProject Properties...

select the protection tab.


have fun and good luck!
-pmover
 
Thanks very much sdz and pmover,

sdz,
very helpful pointer. I cant however find an "Alt+..." keystroke for the greek letter "Pi". Am I missing it? It seems that only some of the characters have the "Alt+..." keystroke associated with them.
Thanks again
 
Also, when I select the character "Pi" from character map to copy it to the VBA module I end up with a question mark in the module when i click the past button.
Am I missing something?
 
Pi isn't available using the [Alt]+... method. Just use the variable name pi in VBA modules. To show it in a spreadsheet you need to choose the "Symbol" character set and you can apply this to individual letters within the text in a cell so that a mix of symbols and english letters can be displayed.

I'm not sure how you would do it if you want to generate text in a module for display in a sheet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor