Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default passing Excel system values (constant) of properties as arguments

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default passing Excel system values (constant) of properties as arguments

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default passing Excel system values (constant) of properties as arguments

Just noted your example - in case you didn't know, the Range object has a
method called BorderAround
eg.
Selection.BorderAround Weight:=xlThick

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Lonnie M." wrote in message
oups.com...
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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default passing Excel system values (constant) of properties as arguments

Thanks--I am always on the lookout for a better way, and you certainly
provided one.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Arguments in Excell UB Excel Worksheet Functions 3 February 13th 07 04:08 PM
Passing Variable Number of Arguments to a Sub blatham Excel Discussion (Misc queries) 4 December 10th 05 10:36 AM
passing arguments by postion through application.run ben Excel Programming 5 January 14th 05 12:22 AM
Passing Arguments Grant Reid Excel Programming 8 May 24th 04 01:39 PM
Passing arguments to a sub routine... Jeff Harbin[_2_] Excel Programming 2 January 29th 04 03:25 AM


All times are GMT +1. The time now is 11:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"