passing Excel system values (constant) of properties as arguments

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to pass system constants as arguments to a procedure or function. In
my case, I want to pass the constants xlThick/xlMedium of the 'Weight'
property to a procedure.
How do I have to do this?
many thanks
roland
 
Roland, this is how I have handled it:

Sub Test()
Call BoxBorder(xlThin)
End Sub

Public Sub BoxBorder(myWeight As Variant)
With Selection.Borders(xlEdgeLeft)
..LineStyle = xlContinuous
..Weight = myWeight
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
..LineStyle = xlContinuous
..Weight = myWeight
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
..LineStyle = xlContinuous
..Weight = myWeight
..ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
..LineStyle = xlContinuous
..Weight = myWeight
..ColorIndex = xlAutomatic
End With
End Sub


HTH--Lonnie M.
 
Just noted your example - in case you didn't know, the Range object has a
method called BorderAround
eg.
Selection.BorderAround Weight:=xlThick
 
Thanks--I am always on the lookout for a better way, and you certainly
provided one.
 

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

Back
Top