Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by likecoding

  1. Hello,

    I am trying to pass excel sheet to a function. I am getting an error in call2 function "object required" in this line: 

    CurrentValue = SheetOne.Cells(2,2)

    Complete code:

    Set ExcelObj = createobject("excel.application")
    ExcelObj.Visible = true
    Set ExcelConfigFile = ExcelObj.Workbooks.Open (configFilePath)
    Set ConfigScriptSheet = ExcelConfigFile.Worksheets("Scripts")
    Function call2(SheetOne)
             ColumnCounter = 1
             For ExcelRow = 1 To TotalColumn
      	         CurrentValue = SheetOne.Cells(2,2) // I get error "object required"
    End Function
    Function call1(ConfigScripSheet)
    	    ValidateConfigFileTemplate = 1
    	    ColumnNo1 =  call2 (ConfigScriptSheet)
    End Function
  2. Hi, 

    For i = 1 to 5
    ' do somthing
    For j = 1 to 5
    ' do something
    if a = b then 
      exit for
    end if
    '' continue here

    I have two for loops. If a = b how can I exit out from both loops so it will continue from the line says "continue here" ?Currently, it exits out of inner loop only. 



  3. Hello,

    How to return true if today plus 45 days is inside the  last 45 of the year? 

    And return false if today plus 45 days is NOT  inside the last 45 day of the year?


    todayDateIs = Date
    todayPlus45Day =  DateAdd("d",45,todayDateIs) 
    if todayPlus45Day inside the last 45 days of the year then 
    return ture
    elseif todayPlus45Day inside the last 45 days of the year then
    return false
    end if

    I am not sure how to compare if todayPlus45Day is inside the last 45 days of the year? 


  4. I am trying to say that if first two characters are like "2m, 3k", it returns true. I mean it prints "a>b". Instead, it should not print any thing.

    First two characters can be numbers or strings. If strings(i.e. 2m, 3k, jj) , it should not print "a>b" at all. If numbers (i.e. 11, 44, 08), then print "a>b" if greater than 8, else do not print.

    It should print "a>b" if first two characters are numeric and greater than 8. Else, do nor print "a>b". 

  5. miless = "2mile(s)"
    myMile = Left(miless,2)
    print myMile
    myMile = cint(myMile)
    print myMile
    If myMile > 8 then
       print "a>b"
    End If

    first line miless variable can have value like "20 miles, 35 miles, empty, no miles, etc". It works only if first two characters are numeric. 

  6. Hi,

    First I will have to read a value. Then read first two characters of the value. Then compare the value to see it it is greater than 8. First two characters sometimes can be null, string, alphanumeric or numeric.  

    		miless = "2mile(s)"
    		myMile = mid(miless,1,2)
    		print myMile
    		If myMile>8 then
               print "a>b"
    		End If

    It is always returning true even though first two characters are not numbers or less than 8. How can I do it?

  • Create New...