![]() |
#30
|
||||
|
||||
![]() Quote:
Parms: 3, 215, 199, 244, 0 And in my code, all of them have defaults, so none of them are required. I loop through them one by one using a Case statement to determine which keyword it is and then process the value. I have actually come up with a couple more parameters as well, all of which can be coded in any order. Code:
ParmStr = Trim(Selection.Tables(1).Range.Previous.Paragraphs.last.Range.Text) ParmStr = Left(ParmStr, Len(ParmStr) - 1) Tokens = Split(ParmStr, " ") If UBound(Tokens) < 1 Then GoTo NoInDocParms If UCase(Tokens(0)) <> ParmKW Then GoTo NoInDocParms For i = 1 To UBound(Tokens) If Tokens(i) = "" Then GoTo Continue_i: End If KwVal = Split(UCase(Tokens(i)), "=") If UBound(KwVal) <> 1 Then msg = "Invalid keyword parameter (" & Tokens(i) & ")" MsgBox msg, vbOKOnly, MyName: GoTo ErrExit: End If Select Case Trim(KwVal(0)) Case "COLUMN" ... process the Column value Case "Headers" 'If it's a Headers parameter, ... process the Headers value Case "RGB1" ... process the RGB1 values Case "RGB2" ... process the RGB2 values Case "MATCHCASE" ... process the MatchCase value Case Else msg = "Invalid keyword parameter (" & Tokens(i) & ")" MsgBox msg, vbOKOnly, MyName: GoTo ErrExit End Select Continue_i: Next i Quote:
But I've never seen a Case statement coded like that. It's always: Code:
Select Case i Case 0: C = Trim(Split(Split(StrParms, "=")(1), ",")(0)) Case 1: StrRGB = Trim(Split(Split(StrParms, "=")(2), ",")(0)) Case 2: Hdr = Trim(Split(StrParms, "=")(3)) End Select |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
bakerkr | Word VBA | 4 | 10-19-2017 02:23 PM |
![]() |
Benbon | Word VBA | 3 | 03-30-2017 02:31 PM |
![]() |
LadyAna | Word | 1 | 12-06-2014 10:39 PM |
![]() |
bertietheblue | Word VBA | 9 | 07-01-2013 12:39 PM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |