Connecting Tech Pros Worldwide Help | Site Map

VBA Excel Macro

  #1  
Old June 18th, 2009, 06:12 PM
Member
 
Join Date: Nov 2008
Posts: 61
I hope this is the right forum for this (if not let me know where i should have posted this) Alright I'm having a little trouble passing some arguments to a function and then having it return what I need it to.

Expand|Select|Wrap|Line Numbers
  1. Sub Startup()
  2.     ProcessCollection(colAbvs, 4)
  3. End Sub
  4.  
  5. Function ProcessCollection(incCollection As Collection, specifiedLength As Integer)
  6.     For counter = 1 To incCollection.Count
  7.     tempString = incCollection.Count
  8.     stringLength = Len(tempString)
  9.     If (stringLength > specifiedLength) Then
  10.         MsgBox stringLength & " is greater than specified length"
  11.     ElseIf (stringLength < specifiedLength) Then
  12.         MsgBox stringLength & " is less than specified length"
  13.     ElseIf (stringLength = specifiedLength) Then
  14.         MsgBox "Equal"
  15. End Function
  16.  
It doesn't seem to like me passing it arguments this way can someone let me know what im doing wrong.
  #2  
Old June 18th, 2009, 06:21 PM
Lives Here
 
Join Date: Jul 2008
Location: Maryland
Posts: 1,121
Provided Answers: 18

re: VBA Excel Macro


I haven't tried this with a Collection, but assuming that all works, line #7 would have to reference the variable counter instead of Count.
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening, copying from, another workbook from VBA Excel macro fails NeverLift answers 5 January 29th, 2009 08:44 AM
Access module to insert Excel macro into an excel command button MitchR answers 1 January 29th, 2009 12:25 AM
Determining if Excel VBA macro still running? ElPresidente answers 1 August 31st, 2008 08:45 PM
Progress bar needed during Excel macro call from MS Access. Mrs Howl answers 2 November 12th, 2005 02:38 PM