Restrict user to insert ClipArt, Picture etc. Power Point 2007

G

Guest

Hi,

I am developing an add-in for powerpoint 2007, in which I have to restrict
the user from using Insert Tab or Insert Commands to insert objects like Clip
Art, Picture, Sound etc. using , on power point slide.

I have diabled the slide using EnableWindow api.

Still the user is able to insert Objects.


Thanks in advance for any help.

--
D.C

....on the deadline, project should be buried where it belongs...

....can be done...
 
A

Austin Myers

Were it me I would have the add-in load an xml file for the ribbon and
remove those options.



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com
 
G

Guest

Hi Austin,

I have tried using custom ribbon. But I don't know how to remove those option.
I tried restrcting them to be executed by creating a custom ribbon xml,
which has events registered for each of those commands. But they are not
fired.

Can you please spare some time and tell me how I can do that, or if you can
give me some link where I can go and find out how to do that..?

Thanks.
--
D.C

....on the deadline, project should be buried where it belongs...

....can be done...
 
G

Guest

Thank you veru much Austin...

I will give it a try and will be back.

Thanks.
--
D.C

....on the deadline, project should be buried where it belongs...

....can be done...
 
P

Patrick Schmid [MVP]

Probably something like this inside your customUI tags
<commands>
<command idMso="ClipArtInsert" enabled="false" />
</commands>

This would disable the button, but the button would still be visible. Do
you want the button to be invisible as well?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
 
G

Guest

Hi Petrick,

I don't need to hide the button, disabling is enough for me. But it has to
be dynamic.

I have an exercise which a student takes and when he completes the exercies
I show him a Report.

I need to disable it on Report.

I gave a try what you had suggested, but didn't worked out.

I had tried using <command> tag to fire click-events previously. But the
event did not fired at all. In fact for power point very limited click-events
got fired.

I would appritiate if you can suggest some other solution.

Thanks for your time.
--
D.C

....on the deadline, project should be buried where it belongs...

....can be done...


Patrick Schmid said:
Probably something like this inside your customUI tags
<commands>
<command idMso="ClipArtInsert" enabled="false" />
</commands>

This would disable the button, but the button would still be visible. Do
you want the button to be invisible as well?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

Thank you veru much Austin...

I will give it a try and will be back.

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...
 
P

Patrick Schmid [MVP]

Let's start out with the static part. Did my suggestion succeed in
disabling the button? If not, please tell me what you did and paste your
full RibbonX here.
We'll worry about the dynamic part once the static version works.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

Hi Petrick,

I don't need to hide the button, disabling is enough for me. But it has to
be dynamic.

I have an exercise which a student takes and when he completes the exercies
I show him a Report.

I need to disable it on Report.

I gave a try what you had suggested, but didn't worked out.

I had tried using <command> tag to fire click-events previously. But the
event did not fired at all. In fact for power point very limited click-events
got fired.

I would appritiate if you can suggest some other solution.

Thanks for your time.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


Patrick Schmid said:
Probably something like this inside your customUI tags
<commands>
<command idMso="ClipArtInsert" enabled="false" />
</commands>

This would disable the button, but the button would still be visible. Do
you want the button to be invisible as well?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

Thank you veru much Austin...

I will give it a try and will be back.

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Fellow MVP and all around good guy Patrick Schmid has an excellent web site
with tons of information on this.
http://pschmid.net/office2007/ribbonx/index.php



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com


Hi Austin,

I have tried using custom ribbon. But I don't know how to remove those
option.
I tried restrcting them to be executed by creating a custom ribbon xml,
which has events registered for each of those commands. But they are not
fired.

Can you please spare some time and tell me how I can do that, or if you
can
give me some link where I can go and find out how to do that..?

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Were it me I would have the add-in load an xml file for the ribbon and
remove those options.



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com



Hi,

I am developing an add-in for powerpoint 2007, in which I have to
restrict
the user from using Insert Tab or Insert Commands to insert objects
like
Clip
Art, Picture, Sound etc. using , on power point slide.

I have diabled the slide using EnableWindow api.

Still the user is able to insert Objects.


Thanks in advance for any help.

--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...
 
G

Guest

Hi Patrick,

The solution you gave didn't work.

I am using Connect.cs which is imitating the Custom Ribbon control, this is
just to reduce the files copied on the end user's machine and also to avoid
possible manipulation of the Custom Ribbon once installed.

The code is as below,
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[GuidAttribute("0B539378-8505-46A5-A391-2DCF5BAC469E"),
ProgId("PowerPoint_Add_In.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2,
Office.IRibbonExtensibility
{


string Office.IRibbonExtensibility.GetCustomUI(string ribbonID)
{
return getResource();
}

private string getResource()
{

string strContent =
"<customUI
xmlns='http://schemas.microsoft.com/office/2006/01/customui' onLoad='OnLoad'>"
+ "<commands>"
+ "<command idMso ='FileCloseOrExit' onAction
='OnFileClose'/>"

+ "<command idMso="ClipArtInsert" enabled="false" />
+ "<command idMso ='ClipArtInsert' onAction ='OnInsert'/>"
+ " </commands>"
+ "</customUI>";

if (MyGlobal.IsAddInLoaded)
return strContent;
else
return "";
}

public void OnFileClose(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (MyGlobal.IsAddInLoaded)
CancelDefault = true;
else
CancelDefault = false;
}

public void OnInsert(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (MyGlobal.IsAddInLoaded && PPT2007AddIn.IsReportGenerated)
CancelDefault = true;
else
CancelDefault = false;
}

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The actual code contains list of othere commands also but to keep it clear,
I have removed the other lines.

Here for Power Point, I am also not able to restrict the Exit command or "x"
button on the top-right corner, which is working fine for Word.

Thanks for your time.


--
D.C

....on the deadline, project should be buried where it belongs...

....can be done...


Patrick Schmid said:
Let's start out with the static part. Did my suggestion succeed in
disabling the button? If not, please tell me what you did and paste your
full RibbonX here.
We'll worry about the dynamic part once the static version works.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

Hi Petrick,

I don't need to hide the button, disabling is enough for me. But it has to
be dynamic.

I have an exercise which a student takes and when he completes the exercies
I show him a Report.

I need to disable it on Report.

I gave a try what you had suggested, but didn't worked out.

I had tried using <command> tag to fire click-events previously. But the
event did not fired at all. In fact for power point very limited click-events
got fired.

I would appritiate if you can suggest some other solution.

Thanks for your time.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


Patrick Schmid said:
Probably something like this inside your customUI tags
<commands>
<command idMso="ClipArtInsert" enabled="false" />
</commands>

This would disable the button, but the button would still be visible. Do
you want the button to be invisible as well?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed


Thank you veru much Austin...

I will give it a try and will be back.

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Fellow MVP and all around good guy Patrick Schmid has an excellent web site
with tons of information on this.
http://pschmid.net/office2007/ribbonx/index.php



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com


Hi Austin,

I have tried using custom ribbon. But I don't know how to remove those
option.
I tried restrcting them to be executed by creating a custom ribbon xml,
which has events registered for each of those commands. But they are not
fired.

Can you please spare some time and tell me how I can do that, or if you
can
give me some link where I can go and find out how to do that..?

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Were it me I would have the add-in load an xml file for the ribbon and
remove those options.



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com



Hi,

I am developing an add-in for powerpoint 2007, in which I have to
restrict
the user from using Insert Tab or Insert Commands to insert objects
like
Clip
Art, Picture, Sound etc. using , on power point slide.

I have diabled the slide using EnableWindow api.

Still the user is able to insert Objects.


Thanks in advance for any help.

--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...
 
P

Patrick Schmid [MVP]

I didn't forget you. I just haven't had the time yet to look into this.
You should hear from me soon...

Hi Patrick,

The solution you gave didn't work.

I am using Connect.cs which is imitating the Custom Ribbon control, this is
just to reduce the files copied on the end user's machine and also to avoid
possible manipulation of the Custom Ribbon once installed.

The code is as below,
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[GuidAttribute("0B539378-8505-46A5-A391-2DCF5BAC469E"),
ProgId("PowerPoint_Add_In.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2,
Office.IRibbonExtensibility
{


string Office.IRibbonExtensibility.GetCustomUI(string ribbonID)
{
return getResource();
}

private string getResource()
{

string strContent =
"<customUI
xmlns='http://schemas.microsoft.com/office/2006/01/customui' onLoad='OnLoad'>"
+ "<commands>"
+ "<command idMso ='FileCloseOrExit' onAction
='OnFileClose'/>"

+ "<command idMso="ClipArtInsert" enabled="false" />
+ "<command idMso ='ClipArtInsert' onAction ='OnInsert'/>"
+ " </commands>"
+ "</customUI>";

if (MyGlobal.IsAddInLoaded)
return strContent;
else
return "";
}

public void OnFileClose(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (MyGlobal.IsAddInLoaded)
CancelDefault = true;
else
CancelDefault = false;
}

public void OnInsert(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (MyGlobal.IsAddInLoaded && PPT2007AddIn.IsReportGenerated)
CancelDefault = true;
else
CancelDefault = false;
}

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The actual code contains list of othere commands also but to keep it clear,
I have removed the other lines.

Here for Power Point, I am also not able to restrict the Exit command or "x"
button on the top-right corner, which is working fine for Word.

Thanks for your time.


--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


Patrick Schmid said:
Let's start out with the static part. Did my suggestion succeed in
disabling the button? If not, please tell me what you did and paste your
full RibbonX here.
We'll worry about the dynamic part once the static version works.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed

Hi Petrick,

I don't need to hide the button, disabling is enough for me. But it has to
be dynamic.

I have an exercise which a student takes and when he completes the exercies
I show him a Report.

I need to disable it on Report.

I gave a try what you had suggested, but didn't worked out.

I had tried using <command> tag to fire click-events previously. But the
event did not fired at all. In fact for power point very limited click-events
got fired.

I would appritiate if you can suggest some other solution.

Thanks for your time.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Probably something like this inside your customUI tags
<commands>
<command idMso="ClipArtInsert" enabled="false" />
</commands>

This would disable the button, but the button would still be visible. Do
you want the button to be invisible as well?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed


Thank you veru much Austin...

I will give it a try and will be back.

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Fellow MVP and all around good guy Patrick Schmid has an excellent web site
with tons of information on this.
http://pschmid.net/office2007/ribbonx/index.php



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com


Hi Austin,

I have tried using custom ribbon. But I don't know how to remove those
option.
I tried restrcting them to be executed by creating a custom ribbon xml,
which has events registered for each of those commands. But they are not
fired.

Can you please spare some time and tell me how I can do that, or if you
can
give me some link where I can go and find out how to do that..?

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Were it me I would have the add-in load an xml file for the ribbon and
remove those options.



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com



Hi,

I am developing an add-in for powerpoint 2007, in which I have to
restrict
the user from using Insert Tab or Insert Commands to insert objects
like
Clip
Art, Picture, Sound etc. using , on power point slide.

I have diabled the slide using EnableWindow api.

Still the user is able to insert Objects.


Thanks in advance for any help.

--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...
 
G

Guest

Thanks Patrick,

I got the solution,

Thanks for your support...


--
D.C

....on the deadline, project should be buried where it belongs...

....can be done...


Patrick Schmid said:
I didn't forget you. I just haven't had the time yet to look into this.
You should hear from me soon...

Hi Patrick,

The solution you gave didn't work.

I am using Connect.cs which is imitating the Custom Ribbon control, this is
just to reduce the files copied on the end user's machine and also to avoid
possible manipulation of the Custom Ribbon once installed.

The code is as below,
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[GuidAttribute("0B539378-8505-46A5-A391-2DCF5BAC469E"),
ProgId("PowerPoint_Add_In.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2,
Office.IRibbonExtensibility
{


string Office.IRibbonExtensibility.GetCustomUI(string ribbonID)
{
return getResource();
}

private string getResource()
{

string strContent =
"<customUI
xmlns='http://schemas.microsoft.com/office/2006/01/customui' onLoad='OnLoad'>"
+ "<commands>"
+ "<command idMso ='FileCloseOrExit' onAction
='OnFileClose'/>"

+ "<command idMso="ClipArtInsert" enabled="false" />
+ "<command idMso ='ClipArtInsert' onAction ='OnInsert'/>"
+ " </commands>"
+ "</customUI>";

if (MyGlobal.IsAddInLoaded)
return strContent;
else
return "";
}

public void OnFileClose(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (MyGlobal.IsAddInLoaded)
CancelDefault = true;
else
CancelDefault = false;
}

public void OnInsert(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (MyGlobal.IsAddInLoaded && PPT2007AddIn.IsReportGenerated)
CancelDefault = true;
else
CancelDefault = false;
}

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The actual code contains list of othere commands also but to keep it clear,
I have removed the other lines.

Here for Power Point, I am also not able to restrict the Exit command or "x"
button on the top-right corner, which is working fine for Word.

Thanks for your time.


--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


Patrick Schmid said:
Let's start out with the static part. Did my suggestion succeed in
disabling the button? If not, please tell me what you did and paste your
full RibbonX here.
We'll worry about the dynamic part once the static version works.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed


Hi Petrick,

I don't need to hide the button, disabling is enough for me. But it has to
be dynamic.

I have an exercise which a student takes and when he completes the exercies
I show him a Report.

I need to disable it on Report.

I gave a try what you had suggested, but didn't worked out.

I had tried using <command> tag to fire click-events previously. But the
event did not fired at all. In fact for power point very limited click-events
got fired.

I would appritiate if you can suggest some other solution.

Thanks for your time.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Probably something like this inside your customUI tags
<commands>
<command idMso="ClipArtInsert" enabled="false" />
</commands>

This would disable the button, but the button would still be visible. Do
you want the button to be invisible as well?

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Outlook 2007 Performance Update: http://pschmid.net/blog/2007/04/13/105
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed


Thank you veru much Austin...

I will give it a try and will be back.

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Fellow MVP and all around good guy Patrick Schmid has an excellent web site
with tons of information on this.
http://pschmid.net/office2007/ribbonx/index.php



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com


Hi Austin,

I have tried using custom ribbon. But I don't know how to remove those
option.
I tried restrcting them to be executed by creating a custom ribbon xml,
which has events registered for each of those commands. But they are not
fired.

Can you please spare some time and tell me how I can do that, or if you
can
give me some link where I can go and find out how to do that..?

Thanks.
--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...


:

Were it me I would have the add-in load an xml file for the ribbon and
remove those options.



Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com



Hi,

I am developing an add-in for powerpoint 2007, in which I have to
restrict
the user from using Insert Tab or Insert Commands to insert objects
like
Clip
Art, Picture, Sound etc. using , on power point slide.

I have diabled the slide using EnableWindow api.

Still the user is able to insert Objects.


Thanks in advance for any help.

--
D.C

...on the deadline, project should be buried where it belongs...

...can be done...
 
G

Guest

Hey Guys,

Done it...

First of all Thanks to Patrick and Austin who are always there to help ppl
like us...
You ppl are great guys...

I made use of the Attribute "startFromScratch"
[Thanks Patrick, I saw this word on your site and started my search on the
same.]

Any ways, the Problem and Solution goes like this,

I have an PowerPoint 2007 add-in which allows the user to enter some details,
and when he is finished he clicks on a button avaiable as a part of add-in.
This generates a Report
which gives user some details about the activity he has done.

I wanted to restrict the user from updating the Report, so I made the slide
disable by EnableWindow API.
And also changed the the Presentation package as MarkeAsFinal

This worked, as MarkAsFinal does not allow the user to use many of the Tab
Options.

But it was not to fullproof solution, the user can change the status of
MarkAsFinal and make use of any Tab on the Ribbon Control.
Even if I hide it from the OfficeMenu, he can go to the Office Options, add
MarkAsFinal command to Quick Access Toolbar and change the status
.... All the hard work, Gone with the wind ... :(

Then as I said I saw the word "startFromScratch" on Patrick's site, and
started searching for the same,

I read somewhere that when we make the "startFromScratch=true",
It only hides the Tabs on Ribbon Control, but it ristricts the user to
manipulate Quick Access Toolbar.

So I tride as bellow and it worked,

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// File connect.cs / Alternativly you can also use CustomUI.xml
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[GuidAttribute("0B539378-8505-46A5-A391-2DCF5BAC469E"),
ProgId("PowerPoint_Add_In.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2,
Office.IRibbonExtensibility
{
static Office.IRibbonUI ribbon;

public void OnConnection(object application,
Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array
custom)
{
applicationObject = application;
addInInstance = addInInst;
}

string Microsoft.Office.Core.IRibbonExtensibility.GetCustomUI (string s)
{
return getResource();
}

private string getResource()
{
if (IsAddInLoaded)
{
string strContent = "";

strContent = "<customUI
xmlns='http://schemas.microsoft.com/office/2006/01/customui'
onLoad='Ribbon_OnLoad'>"
+ "<commands>"
+ "<command idMso ='FileNew' onAction ='OnFileNew'/>"
+ "<command idMso ='FileNewDefault' onAction
='OnFileNew'/>"
+ "<command idMso ='FileOpen' onAction
='OnFileOpen'/>"
+ "<command idMso ='FileClose' onAction
='OnFileClose'/>"
+ "<command idMso ='FileCloseOrExit' onAction
='OnFileClose'/>"
+ "<command idMso ='FileSave' onAction
='OnFileSave'/>"
+ "</commands>"
// startFromScratch='true'
+ "<ribbon startFromScratch='true'>"
// This part is not required as "strartFromScratch=true" takes care of
all the menu items
// I have kept it here just for infromation, that if in case any one
wants to remove commands from Office Menu.
+ "<officeMenu>"
+ "<menu idMso='FilePrepareMenu' visible='false' />"
+ "<toggleButton idMso='FileMarkAsFinal' visible='false' />"
+ "</officeMenu>"
// Make default tabs visible.
+ "<tabs>"
+ "<tab idMso='TabHome' visible='true' label='Home' />"
+ "<tab idMso='TabInsert' visible='true' label='Insert' />"
+ "<tab idMso='TabDesign' visible='true' label='Design' />"
+ "<tab idMso='TabAnimations' visible='true' label='Animations' />"
+ "<tab idMso='TabSlideShow' visible='true' label='Slide Show' />"
+ "<tab idMso='TabReview' visible='true' label='Review' />"
+ "<tab idMso='TabView' visible='true' label='View' />"
// Add Custom Tab for Print
+ "<tab id='tabPrint' label='Print'>"
+ "<group id='grpPrint' label='Print'>"
+ "<button id='btnPrintPreview' size='large' label='Print Preview'
onAction ='OnPrintPreview' image='FilePrintPreview' />"
+ "<button id='btnPrint' size='large' label='Print' onAction ='OnPrint'
image='FilePrint' />"
+ "</group></tab>"
+ "</tabs>"
+ "</ribbon>"
+ "</customUI>";

return strContent;
}
else
return "";
}

public void Ribbon_OnLoad(Office.IRibbonUI r)
{
ribbon = r;
}

public void OnFileOpen(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (IsAddInLoaded)
CancelDefault = true;
else
CancelDefault = false;
}

public void OnFileNew(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (IsAddInLoaded)
CancelDefault = true;
else
CancelDefault = false;
}

public void OnFileSave(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (IsAddInLoaded)
CancelDefault = true;
else
CancelDefault = false;
}

public void OnFileClose(Office.IRibbonControl control, ref bool
CancelDefault)
{
if (IsAddInLoaded)
CancelDefault = true;
else
CancelDefault = false;
}

private object applicationObject;
private object addInInstance;

public void OnPrint(Office.IRibbonControl control)
{
((Microsoft.Office.Interop.PowerPoint.Application)
applicationObject)
.CommandBars.ExecuteMso("FilePrint");
}

public void OnPrintPreview(Office.IRibbonControl control)
{
((Microsoft.Office.Interop.PowerPoint.Application)
applicationObject)
.CommandBars.ExecuteMso("FilePrintPreview");
}

//+++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++
// Other "IDTExtensibility2" implementation is required
//+++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++


}


--
D.C

....on the deadline, project should be buried where it belongs...

....can be done...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top