BERT delay in shape with graphic - vba

I am having a problem moving a shape created by BERT in my VBA code. If I run the VBA macro that calls Bert to create the chart, and then submit in a second call for the code to move the shape, it works. If I try to combine the code it does not work. I think it's possible the shape does not yet exist when I combine calls. I can also make it work if I call the move code from a worksheet event such as "SelectionChange." However, this make the application look awkward.
https://github.com/sdllc/Basic-Excel-R-Toolkit/issues/116

So I'm not sure why this happens, but it has something to do with the interaction between VBA, COM and R. In any event you can work around it by adding a shape with the name first (if it doesn't already exist).

Related

VBA PPT Event triggered when chart is added

I am trying to write an VBA-Code that triggers whenever a chart is added in PPT. So far I found
this list: Link. However the options don't work, I thought maybe using "AfterShapeSizeChange", since it comes kind of close. But even this event does not work/trigger.
Anybody has an idea what I could use?
Kind regards

vba updateable shape controls in master shape

I am having a bear of a time finding an answer to what seems like a simple question. I am using Visio 2010. I need to have something like text box that I can update through VBA. I have to code to do it
shape.CellsU("Prop.Memory").Formula = """256 MB"""
for example (shape is a variable in this case). The problem is that I can't find out how to tie a control, like a text box or label, to a user defined property like "Prop.memory" in this case. I thought it might be a data graphic but adding a data graphic is disabled for me.
Michael.
I think that I have a solution. It is an odd one but it might work. The problem is that you cannot apply Data graphics when you have the master open in edit mode. what you can do is drop the master on the sheet based on the recordset. now you can add data graphics because it has a record source (I am guessing). I made the changes I need to that layout that I needed. I then dragged that shape to the stencil to become a new master. it will maintain the data links. it seems like an odd way to go about it but it does work. I might be good for now.
update: this didn't work for what I needed. I did find the way, though, on this site: Creating custom Visio shapes
Once you create the shape with the right fields, you have to use something like the following code to update it via VBA:
shp.cells("prop.Memory").Formula= chr(34) & "256 MB" & chr(34)
where shp is a visio shape
I just wanted to be the solution that I found is out there.
Cheers, Michael.

Run Macro on add/drop in Visio

Is there anyway to run a macro when you add or drop a shape from a container? Or is there a way to automatically run a small vba script every couple of seconds?
The Visio Shapesheet EventDrop cell lets you specify code to call when the shape is dropped on the page. It also works when duplicating the shape.
If it's a VBA macro then you can use CALLTHIS or RUNMACRO. CALLTHIS requires that the first argument in your VBA macro is a Visio.Shape object, where RUNMACRO does not.
I don't know of any way to run a macro every few seconds, at least not any way that works well.

How to create a PowerPoint timer?

I have to complete a timer in PowerPoint, it counts down for a specificed amount of time when a shape on particular slide is clicked. I heard macros could be a way to do this, but I have very little knowledge about them. With my research I was able to add a macro and pop out a message box when a shape is clicked.
How can I implement a timer with this? VBA syntax is pretty unfamiliar to me. What happens after timer finishes is another question though.
Ok this is a late answer but for the people coming across such task, I got over this using custom animations in PowerPoint instead of doing it with macros. There is variety of things you can do with animations so it's probably better for you to search internet for specifically what you want to do.

Passing parameter to VBA Macro

I am trying to run a macro when I double click on Visio shapes.
I want to pass the shape object to the VBA macro so that I could do something in the macro depending on the id of the Shape object.
Is it possible to pass the parameter to VBA macro. If yes, please let me know how?
Thanks.
You can put your macro as the EventDblClick event on the shapes you want to watch. To do this you would use the CallThis function (http://msdn.microsoft.com/en-us/library/aa212649(office.11).aspx) to have your macro called every time a shape is double-clicked.
This would require though, that you modify the shapesheet for every shape you want to watch. If you're providing the master(s) for the shapes you want to watch it shouldn't be a big deal, but otherwise you'd have to write code that will add the event to every shape you want to watch (though you could use the Document_ShapeAdded event on a document to add your event to the shapesheet whenever a shape is added)
When you click on an object, the Selection changes. You can use the Selection object in your macro to refer to the currently selected object.
I'm not sure if a macro can be run on double click, but my VBA experience does not come from Visio. As bit of googling turns up that this somehow seems to be possible. If you put it as a Button on a CommandBar, with a little more effort even in the context menu, you would be restricted to a Sub procedure without parameters in any case.