vba - "ByRef argument type mismatch" when passing For Each iteration Object to Function -


when trying pass table object separate function byref argument type mismatch error.

code error occurs:

dim doc word.document set doc = activedocument  each outertable in doc.tables     each innertable in outertable.tables         if instr(innertable.cell(1, 1).range.text, "somestring") > 0             currentcv.addproject extractprojectinfo(innertable) ' <- error here         end if     next innertab next outertable 

extractprojectinfo method:

function extractprojectinfo(projtable table) project     dim proj project     set proj = new project     ' commented out code     set extractprojectinfo = proj end function 

passing in other object works fine, it's table gives error. i'm assuming i'm missing simple here? what's stranger method did work @ point, , can't remember having changed relating loop or function.

can try change function declaration -

function extractprojectinfo(byval projtable table) project

or add line -

dim innertable table

before -

for each innertable in outertable.tables


Comments

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -