vba - ByRef Argument Type Mismatch while calling function -


i writing small vba code, , getting error byref argument type mismatch when function loopthroughnamesandpopulatevalues() called main()

sub main()     call loopthroughquotenamesandpopulatevalues("sheet2", 1, 1) end sub  sub loopthroughquotenamesandpopulatevalues(byval sheetname string, byval row integer, byval column integer)     dim sheet excel.worksheet     set sheet = thisworkbook.sheets(sheetname)      = row 10000         if sheet.cells(i, column).value = ""             exit         else             call finder_get_query(sheetname, i, column)         end if     next end sub 

option explicit: add "option explicit" top of module , compile. guess code won't compile because not declared. maybe not issue though, unless finder_get_query choking on i.

error handling: put error handler in finder_get_query , 1 in loopthroughnamesandpopulatevalues , see 1 catches error. narrow down code.

many simple problems can solved following these 2 steps. here preferred error handler, handy debugging because allows resume @ runtime if want:

sub sampleerrorhandler()      on error goto eh      'code      goto finish  eh:     err         msgbox "error:" & vbtab & .number & vbcrlf _             & "source" & vbtab & .source & vbcrlf _             & .description     end      'for debugging purposes     debug.assert 0     goto finish     resume  finish:      'clean up, release resources  end sub 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -