掌握VBA技巧,实现大纲转幻灯片

文章主题:大纲转幻灯片, PowerPoint, VBA工具, 第三方软件

666AI工具大全,助力做AI时代先行者!

 NEW BING采用GPT4训练模型,可以免费使用。今天我们通过new bing来模拟微软Office Copilot功能,快速生成一份PPT演示文档。先说下今天的整体思路。微软Office-Copilot的官方演示中,通过告知copilot需要的文档主题,copilot会通过自然语义理解、上下文关系、信息组织整理完成文档信息,并采用微软设计灵感和内置模板库完成整体PPT美化。这里我们拆解为两个步骤:01 :使用new bing准备PPT的大纲和细节要求。02 :使用PowerPoint内置的设计功能,完成PPT的简单排版和美化

在本篇文章中,我们将探讨如何将大纲成功地转化为幻灯片。为了实现这个目标,我们并不依赖任何第三方软件,而是选择使用PowerPoint自带的VBA(Visual Basic for Applications)工具来完成这项任务。

接下来我们细化以下要求:    PPT主题:《介绍世界五大最高峰的》    PPT页数:7页    PPT结构:1页封面、5页介绍、1页封底

    介绍内容:每座高峰至少介绍3个信息。

01使用New Bing生成内容和自动化VBA

魔法指令:please write me vba code to create 6 PowerPoint slides about top 5 world famous paintings including a cover as the first page. Each slide comes with a short description from 3 differnt aspects and an image of the painting from wikipedia.

中文翻译:请为我编写VBA代码,创建6张关于世界上最著名的5幅画的PowerPoint幻灯片,包括第一页的封面。每张幻灯片都附有一个简短的描述,从3个不同的方面和维基百科上的画作图片。

new bing会很快帮我们将VBA代码写出来。如果代码过长导致输出不完整。我们可以使用补充指令:

魔法指令:continue to finish the code from where you stop.

中文翻译:请继续完成代码

得到以下代码,我们就可以使用PowerPoint自带的VBA宏,模拟微软Office-Copilot 生成PPT文件了。Sub CreateSlides() Declare variables Dim pptApp As PowerPoint.Application Dim pptPres As PowerPoint.Presentation Dim pptSlide As PowerPoint.Slide Dim pptShape As PowerPoint.Shape Dim pptText As PowerPoint.TextRange Dim i As Integer Dim paintings As Variant Dim titles As Variant Dim descriptions As Variant Dim urls As Variant Initialize arrays of paintings, titles, descriptions and urls paintings = Array(“Mona Lisa”, “The Last Supper”, “Girl with a Pearl Earring”, “Guernica”, “The Starry Night”) titles = Array(“Mona Lisa by Leonardo da Vinci”, “The Last Supper by Leonardo da Vinci”, “Girl with a Pearl Earring by Johannes Vermeer”, “Guernica by Pablo Picasso”, “The Starry Night by Vincent van Gogh”) descriptions = Array(“This painting is one of the most famous and mysterious portraits in the world. It depicts a woman with an enigmatic smile and a landscape background. Some believe that she is Lisa Gherardini, the wife of a Florentine merchant, while others suggest that she is Leonardos mother or even himself in drag.”, _ “This painting is a masterpiece of Renaissance art that shows the scene of Jesus and his disciples having their final meal before his crucifixion. Leonardo used perspective and gestures to create a dramatic and realistic composition. He also painted each disciple with a distinct personality and reaction to Jesus announcement of his betrayal.”, _ “This painting is a stunning example of Dutch Golden Age art that captures the beauty and innocence of a young woman. She wears an exotic turban and a large pearl earring, and looks over her shoulder at the viewer with a curious expression. Some think that she is Vermeers maid or daughter, but her identity remains unknown.”, _ “This painting is a powerful anti-war statement that depicts the horrors of the bombing of Guernica, a Basque town in Spain, during the Spanish Civil War. Picasso used a monochromatic palette and distorted figures to convey the suffering and chaos of the event. He also included symbols of Spanish culture, such as the bull and the horse.”, _ “This painting is one of the most famous and beloved works of modern art that expresses the artists emotions and vision. It shows a swirling night sky over a small village and a cypress tree. Van Gogh painted it from memory while staying at an asylum in Saint-Remy-de-Provence, France.”) urls = Array(“https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/1200px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg”, _ “https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/Leonardo_da_Vinci_%281452-1519%29_-_The_Last_Supper_%281495-1498%29.jpg/1920px-Leonardo_da_Vinci_%281452-1519%29_-_The_Last_Supper_%281495-1498%29.jpg”, _ ” https://upload.wikimedia.org/wikipedia/commons/thumb/0/0f/1665_Girl_with_a_Pearl_Earring.jpg/1280px-1665_Girl_with_a_Pearl_Earring.jpg”, _ “https://upload.wikimedia.org/wikipedia/en/thumb/7/74/PicassoGuernica.jpg/1920px-PicassoGuernica.jpg”, _ “https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg/1920px-Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg”) Create a new PowerPoint application and presentationSet pptApp = New PowerPoint.ApplicationSet pptPres = pptApp.Presentations.Add Create a cover slide with title and subtitle Set pptSlide = pptPres.Slides.Add(1, ppLayoutTitle) Set pptText = pptSlide.Shapes(1).TextFrame.TextRange pptText.Text = “Top 5 World Famous Paintings” Set pptText = pptSlide.Shapes(2).TextFrame.TextRange pptText.Text = “A PowerPoint presentation created by Bing” Loop through the paintings array and create a slide for each oneFor i = 0 To 4 Create a blank slide Set pptSlide = pptPres.Slides.Add(i + 2, ppLayoutBlank) Add a title with the painting name and artistSet pptShape = pptSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 50, 50, 600, 50)Set pptText = pptShape.TextFrame.TextRange pptText.Text = titles(i) pptText.Font.Size = 24 pptText.Font.Bold = True Add a picture of the painting from the url Set pptShape = pptSlide.Shapes.AddPicture(urls(i), msoFalse, msoTrue, 50, 150, 400, 300) Add a text box with the description of the paintingSet pptShape = pptSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 500, 150, 300, 300)Set pptText = pptShape.TextFrame.TextRange pptText.Text = descriptions(i) pptText.Font.Size = 18Next i Save the presentation as a PowerPoint file pptPres.SaveAs “Top 5 World Famous Paintings.pptx” Close the presentation and quit the application pptPres.Close pptApp.Quit Release the variables Set pptApp = Nothing Set pptPres = Nothing Set pptSlide = Nothing Set pptShape = Nothing Set pptText = NothingEnd Sub接下来,我们按如下步骤操作:    01 – 打开PowerPoint,    02 – 点击菜单的开发者选项    03 – 点击最左侧VBA宏-    04 – 在VBA窗口点击插入-模块,    05 – 输入上方代码,并点击  运行代码。

运行中,会看到如下界面,耐心等待后,PowerPoints 会自动关闭。

请不要担心。这是因为newbing提供的代码最后,使用了自动关闭的代码语法。

接下来,我们打开“我的文档”,并找到刚才保存的文件。\sj\OneDrive – xwdjn\

替换为自己的文档地址。

“C:\Users\sj\OneDrive – xwdjn\Documents\Top 5 World Famous Paintings.pptx”

02

使用设计灵感完成PPT美化我们已经看到6页幻灯片已经以简单的左右结构呈现在面前。接下来,要求我们具有一个Office365权限的账号。这里可以自行准备一下,或给我留言,我会在后面补充获取Office365的方法。第一步:使用自带的设计菜单,选择合适的主题。这里我们选一个文艺一些的浅色主题。

第二步:使用设计灵感功能,对每一页PPT进行快速的排版

            开始(home)-设计灵感(design)

第三步:我们导出为PDF,查看整体的效果。

至此,认为模仿微软Office-copilot工作流方式生成PPT的实战就结束了。

最后还是有几点要说明:

每个人的chatGPT或者是newbing,每一次生成的结果都是不同的。同样的需求,编程代码也有不同的实现思路,所以大家还是要对vba原理有一定的基础了解。

文中代码有一处图片链接是错误的,会导致代码报错,解决思路大家可以留言交流。

还是那句话,人工智能的出现对于基础经验丰富且愿意接受新事物的人来说,是巨大的生产力提升,人工智能目前还是只能作为助手存在,我们还是应该丰富自己的技能栈,做到不被工具淘汰。

大纲转幻灯片, PowerPoint, VBA工具, 第三方软件

AI时代,拥有个人微信机器人AI助手!AI时代不落人后!

免费ChatGPT问答,办公、写作、生活好得力助手!

搜索微信号aigc666aigc999或上边扫码,即可拥有个人AI助手!

Leave a Reply