vba - Object variable or With Block variable not set error when accessing members of BuildingBlockEntries collection -


i attemping access members of template's buildingblockentries collection through macro in microsoft word 2007. collection, first thought for each loop best way to this:

 each bblock in normaltemplate.buildingblockentries         messagebox.show (bblock.name)     next bblock 

however attempt through error: object doesn't support property or method. tried method suggested here:

templates.loadbuildingblocks    dim ibb integer ibb = normaltemplate.buildingblockentries.count() dim bb word.buildingblock dim integer dim objcounter object  if ibb > 0    = 1 ibb     objcounter =     bb = normaltemplate.buildingblockentries.item(objcounter)     messagebox.show (bb.name)   next  end if    

however, resulting in error shown in title: object variable or block variable not set.

i have tried using integer variable index, i specifically, avail. how can acheive desired effect? wrong attempt?

thank help.

with 2nd question answer need use set, bb object:

set bb = normaltemplate.buildingblockentries.item(objcounter) 

for more info on set take @ so question.

with for/next loop, it's not clear how you've declared bblock. guess should like:

dim bblock buildingblock 

and perhaps for line should reference buildingblocks instead of buildingblockentries:

for each bblock in normaltemplate.buildingblocks 

i don't know sure though, i'm looking @ pops in intellisense.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -