Tuesday, 15 March 2011

MS Access 2010 Change Theme Through VBA -



MS Access 2010 Change Theme Through VBA -

i hoping create simple form in ms access 2010 database user can select theme used. how alter database's theme through vba? google hasn't been helpful question.

i know question asked while ago, since came across while researching setting themes, thought should seek provide of found.

when comes letting user pick theme, think easiest way set "colors" button in ribbon. if happen have made own custom ribbon can utilize <control idmso="themecolorsgallery" /> reference "colors" option.

if want seek have more exact command of happens, think may have found option, little more involved , haven't worked out details yet. wanted post it, though, because thought might want create utilize of it.

while working on controlling image gallery feature, realized there entry "office theme" in hidden "msysresources" table. believe whatever in "office theme" row in "mysysresources" table determines theme loaded when programme starts. way tested thought picked theme , went table , saved attachment desktop. went , picked different theme , ensured in place looking @ of forms. then, went table , deleted in "office theme" row , uploaded saved file attachment. after closed , re-opened program, theme had saved desktop , later re-loaded on top of current theme theme beingness used.

the way envision perchance used assign attachment via code. in particular seems though useful, if wanted override default settings based on configuration alternative specific program.

update 8/18/15: has requested details how able set theme via vba , i'll provide them here. basic theory save info attachment field in msysresources table. if ever need overwrite current theme saved theme, extract table , save in appropriate msysresources record. note i'm using mysql table storage platform , i'm using mediumblob field called "lgo" store data.

here 2 functions, use. first function saves theme mysql table. sec function extracts saved info , saves on top of current theme in msysresourcestable. please note see effect of sec function have close , re-open programme after having run function.

function svethm()'save theme dim msr recordset, atc recordset, lr recordset set msr = currentdb.openrecordset("select * msysresources [name]='office theme'", dbopendynaset) if msr.recordcount > 0 set atc = msr!data.value set lr = currentdb.openrecordset("select * tbllgo;", dbopendynaset) if lr.recordcount = 0 lr.addnew else lr.edit lr!stn = lgostn lr!lgo = cstr(atc!filedata) lr!typ = typ lr.update lr.close msgbox "your theme has been saved." end if end function function setmsys()'set msysresources dim msys recordset, lgo recordset, atc recordset set msys = currentdb.openrecordset("select * msysresources [name]='office theme'", dbopendynaset) if msys.recordcount > 0 msys.edit set atc = msys!data.value atc.edit set lgo = currentdb.openrecordset("select lgo tbllgo;", dbopendynaset) if lgo.recordcount > 0 atc!filedata = lgo!lgo lgo.close atc.update msys.update end if end function

vba ms-access themes

No comments:

Post a Comment