ppt vba 程序设计

 

public   void  BootPPT()
        
{

            _app 
= new PPT.ApplicationClass();
            _app.Activate();
            pptPre 
= _app.Presentations.Add(
            Microsoft.Office.Core.MsoTriState.msoTrue);
            pptPre.Slides.Add(
1, PPT.PpSlideLayout.ppLayoutText);
            
            pptPre.Slides[
1].Shapes[1].TextFrame.TextRange.Text ="ssss" ;

            pptPre.Slides[
1].Shapes[2].TextFrame.TextRange.Text = "bbbb";

          

            
...

        }

using

System;

using

System.Collections.Generic;

using

System.Text;

using

PPT = Microsoft.Office.Interop.PowerPoint;

using

ACCESS = Microsoft.Office.Interop.Access;

using

Microsoft.Office.Core;

using

System.Windows.Forms;

using

System.Drawing;

namespace

{

 

LnPPt class PPtObject

{

 

 

 

 

 

 

{

_app =

_app.Activate();

pptPre=_app.Presentations.Add(

Microsoft.Office.Core.

 

pptPre.Slides.Add(1,PPT.

pptPre.Slides[1].Shapes[1].TextFrame.TextRange.Text =

pptPre.Slides[1].Shapes[2].TextFrame.TextRange.Text =

_app.CommandBars[

 

 

 

private PPT. Application _app; private PPT. AutoCorrect _Auto; private PPT. Presentation pptPre; private PPT. AutoCorrect autoCorrect; public void BootPPT() new PPT. ApplicationClass (); MsoTriState .msoTrue); PpSlideLayout .ppLayoutText); "This is title!" ; "This is body!" ; "Tools" ].Controls[ "AutoCorrect Options..." ].Execute(); //pptPre.SaveAs("E://cofei//Documents//testppt.ppt",Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsPowerPoint7,Microsoft.Office.Core.MsoTriState.msoFalse);

 

 

//_app.CommandBars["Tools"].Controls["AutoCorrect Options..."].Execute();

}

 

{

 

public IntPtr hWnd get

{

 

}

}

 

{

}

 

 

 

 

 

return ( IntPtr )_app.HWND; public void EditAutoCorrect() //

 

{

 

 

PPT.

PPT.

Microsoft.Office.Core.

Microsoft.Office.Core.

Microsoft.Office.Core.

 

open a ppt file

*********************************/

public void pptopen() string filename = "C://Documents and Settings//Administrator//Desktop//cofei//Presentation1.ppt" ; Application pa = new PPT. ApplicationClass (); Presentation pp = pa.Presentations.Open(filename, MsoTriState .msoTrue, MsoTriState .msoFalse, MsoTriState .msoFalse); /******************************

 

//PPT.Application pa = new PPT.ApplicationClass();

 

//pa.Activate();

 

//pa.Presentations.Open(filename,

 

// Microsoft.Office.Core.MsoTriState.msoTrue,

 

// Microsoft.Office.Core.MsoTriState.msoFalse,

 

// Microsoft.Office.Core.MsoTriState.msoFalse);

 

//pa.CommandBars["Tools"].Controls["AutoCorrect Options..."].Execute();

 

 

string [] strKeyWordList ={ "bbbbbb" }; //要搜索的文本

PPT.

 

{

 

{

 

{

oText =

 

 

TextRange oText; foreach (PPT. Slide slide in pp.Slides) foreach (PPT. Shape shape in slide.Shapes) foreach ( string strKeyWord in strKeyWordList) null ; //oText = shape.TextFrame.TextRange.Find(strKeyWord, 0, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue);

 

oText = shape.TextFrame.TextRange;

 

 

MessageBox .Show(oText.Text.ToString()); //if (oText != null)

 

//{

 

// MessageBox.Show("文档中包含指定的关键字 " + strKeyWord + " !", "搜索结果", MessageBoxButtons.OK);

 

// continue;

 

//}

 

//else

 

//{

 

// MessageBox.Show("文档中不包含指定的关键字 " + strKeyWord + " !", "搜索结果", MessageBoxButtons.OK);

 

// continue;

 

//}

}

}

}

 

 

 

 

}

}

}

 
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值