powerpoint-vba

A good substitute for references/pointers in VBA?

天大地大妈咪最大 提交于 2019-11-29 13:54:24
Can you recommend me a good substitute for reference or pointer types in VBA? I have been struggling for long with expressions like this: dblMyArray( i * lngDimension0 + j * lngDimension1 + k * lngDimension2, l * lngDimension3 + m * lngDimension4 ) = dblMyArray( i * lngDimension0 + j * lngDimension1 + k * lngDimension2, l * lngDimension3 + m * lngDimension4 ) + 1 If I wanted to accumulate values in a multidimensional array in e.g. C++, I could write this: double& rElement = dblMyArray[ i * lngDimension0 + j * lngDimension1 + k * lngDimension2 ][ l * lngDimension3 + m * lngDimension4 ];

Customizing the PowerPoint Ribbon at Run-Time

梦想的初衷 提交于 2019-11-29 10:59:11
I am developing a PowerPoint add-in and would like to temporarily disable some of the Ribbon controls while the add-in application is running . I have developed a solution that works as expected when the Add-In is enabled , but this is not really adequate, because it disables some commonly used controls, like SlideMaster, SlideSorter, etc. I am using PowerPoint 2010. Here is a sample XML which is well-formed: <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="false"> <tabs> <tab idMso="TabView"> <group idMso="GroupMasterViews" getVisible=

How to get the MD5 hex hash for a file using VBA?

前提是你 提交于 2019-11-29 00:04:00
How can I get the MD5 hex hash for a file using VBA? I need a version that works for a file. Something as simple as this Python code: import hashlib def md5_for_file(fileLocation, block_size=2**20): f = open(fileLocation) md5 = hashlib.md5() while True: data = f.read(block_size) if not data: break md5.update(data) f.close() return md5.hexdigest() But in VBA. http://www.di-mgt.com.au/crypto.html#MD5 An older question that could use a better answer. These functions are specifically for hashing files, not for hashing passwords. As a bonus, I'm including a function for SHA1. If you get rid of the

Get shape by Id or Name

三世轮回 提交于 2019-11-28 13:43:05
Is there any way to get a shape if you know its Id ? For example: Dim myshape As Shape myshape.Id = 42 myshape = getShapeById(myshape.Id) Or, alternatively, could I get the shape by Name ? Dim myshape As Shape myshape.Name = "Rectangle 42" myshape = getShapeByName(myshape.Name) Todd Main Getting a shape .Name by its .Id is somewhat more convoluted than getting its .Id by its .Name . But here's how it's done: Sub PrintShapeName() Debug.Print getNameByID(3, 1) End Sub Function getNameByID(shapeID As Long, slide As Integer) Dim ap As Presentation: Set ap = ActivePresentation Dim sl As slide: Set

How to populate an array from text file in Visual Basic for PowerPoint 2010

六月ゝ 毕业季﹏ 提交于 2019-11-28 13:06:08
I'd like to define an array like: sample_array = Array( _ "foo", _ "bar", _ ... "dog", _ "cat" _ ) ...in a macro written in VB for Applications (PowerPoint 2010 in this case), but I need to define the array from a text file that would just be formatted like: foo bar ... dog cat What is the simplest way to define a text file path and read the values (assume they are always regular ascii strings) directly into an array? Thanks! Dim arr() as String dim i as Integer i=0 Open "c:\test.txt" For Input As #1 ' Open file for input. Do While Not EOF(1) ' Loop until end of file. Line Input #1, arr(i) '

Extracting all text from a powerpoint file in VBA

江枫思渺然 提交于 2019-11-28 12:27:34
I have a huge set of powerpoint files from which I want to extract all the text and just lump it all into one big text file. Each source (PPT) file has multiple pages (slides). I do not care about formatting - only the words. I could do this manually with a file by just ^A ^C in PPT, followed by ^V in notepad; then page down in the PPT, and repeat for each slide in the powerpoint. (Too bad I can't just do a ^A that would grab EVERYTHING ... then I could use sendkey to copy / paste) But there are many hundreds of these PPTs with different numbers of slides. It seems like this would be a common

How to Copy paste data range from Excel to powerpoint slide

a 夏天 提交于 2019-11-28 11:01:12
问题 I am trying to prepare code to copy and paste excel data range from excel sheet to powerpoint slide but I am able to paste images only. Please help with the suitable code. The code I am using is as follows: Sub WorkbooktoPowerPoint() Dim pp As Object Dim PPPres As Object Dim PPSlide As Object Dim Rng As Range Set pp = CreateObject("PowerPoint.Application") Set PPPres = pp.Presentations.Add pp.Visible = True Set Rng = ActiveSheet.Range("B1:J31") Rng.Copy SlideCount = PPPres.Slides.Count Set

How to get Ribbon custom Tabs IDs?

99封情书 提交于 2019-11-28 09:24:53
I am working with a Custom Ribbon in Power Point, I need to iterate through all tabs and get the ID of them. The Ribbon contains Tabs added from different projects (C++, C#) as addins and I don't know their IDs. I am using VBA to handle the events fired from the Ribbon. How do I do to get the ID from all tabs in the Ribbon using VBA? Thanks in advance. Alain The Ribbon is accessed using CommandBars("Ribbon") which returns an IAccessible object. You access tabs by using AccessibleChildren _ Lib "oleacc.dll" _ (ByVal paccContainer As Object, _ ByVal iChildStart As Long, _ ByVal cChildren As Long

How to update excel embedded charts in powerpoint?

给你一囗甜甜゛ 提交于 2019-11-28 09:24:28
I have 30 charts that were created from excel and were pasted onto powerpoint slides. Every month, I have to update these 30 embedded charts by manually clicking on the charts and edit. I am aware there is an option to use paste special, so that the data in the charts can be updated automatically by clicking the update links. However, my charts needs to be edited by some users. Paste special option does not allow users to edit the charts. Hence, I am unable to use this paste special option. I think the solution lies in writing a vba in powerpoint. Can any expert here offer to write this vba

A good substitute for references/pointers in VBA?

◇◆丶佛笑我妖孽 提交于 2019-11-28 08:13:09
问题 Can you recommend me a good substitute for reference or pointer types in VBA? I have been struggling for long with expressions like this: dblMyArray( i * lngDimension0 + j * lngDimension1 + k * lngDimension2, l * lngDimension3 + m * lngDimension4 ) = dblMyArray( i * lngDimension0 + j * lngDimension1 + k * lngDimension2, l * lngDimension3 + m * lngDimension4 ) + 1 If I wanted to accumulate values in a multidimensional array in e.g. C++, I could write this: double& rElement = dblMyArray[ i *