vba - Excel-2010 - CustomUI - Backstage : Errors when various files are opened in the same instance -


firstly, i'm happy join community. hope exchange advice. i'm french excuse me mistakes in sentences.

i try explain problem :

i had "good" idea use backstage of excel file create small dashboard. works well.

the problem arises when file opened at same time file, in same instance of excel. second file trying access functions "backstage_onshow" , "backstage_onhide" of workbook have message "impossible run macro 'backstage_onshow' (or 'backstage_onhide'). possible macro not available in workbook ..." <- this translation french error message.

how can not have message or rather ensure backstage specific file , not instance of excel?

i show code snippets. more clear.

in xml, have :

<customui xmlns="http://schemas.microsoft.com/office/2009/07/customui" onload ="ribbon_load">   <ribbon startfromscratch="false"/>   <backstage onshow="backstage_onshow" onhide="backstage_onhide"> ...   </backstage> </customui> 

in excel file, have :

public sub ribbon_load(ribbon iribbonui)    set ruban = ribbon  end sub  public sub backstage_onshow(byval contextobject object)      'rafraichissement du ruban     ruban.invalidate  end sub  public sub backstage_onhide(byval contextobject object)    end sub 

all contained in excel file, normal. in excel 2010, excel files open default in same instance, not bother me, but, when "normal" file opened in same instance customized backstage file, normal file tries, not know miracle, access function backstage_onshow backstage_onhide , display backstage. however, file should not knows these functions exist because not reported him.

thank in advance.

sincerely,

patrice.

ps : link if want show file. it's safe code snippets of course !

@david, have solution !!!!

thanks have take time answer me !!!

i try explain you.

so, if think few moment, note problem need stated place store our code snippets. place in xlstart !!! if use personal.xlsb store :

public sub ribbon_load(ribbon iribbonui)    set ruban = ribbon  end sub  public sub backstage_onshow(byval contextobject object)      'rafraichissement du ruban     ruban.invalidate  end sub  public sub backstage_onhide(byval contextobject object)      'erreursaisietaux = 0  end sub 

after, can modify customui.xml :

<customui xmlns="http://schemas.microsoft.com/office/2009/07/customui" onload ="personal.xlsb!ribbon_load">   <ribbon startfromscratch="false"/>   <backstage onshow="personal.xlsb!backstage_onshow" onhide="personal.xlsb!backstage_onhide"> ...   </backstage> </customui> 

i have tried , works.

what think idea ? see drawbacks method ?

patrice.


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -