I am rewriting master using the replaceshape method in VISIO.
I want to replace the format of shape data, but not to replace the value of shape data.
When I check the "ReplaceLockShapeData = 1", both format and value of shape data replaced by new master.
How can I change the format only?
both format and value of shape data replaced by new master.
You mean shape data of sub-shapes ?
Related
Im trying to use an input table and output table, where the inputs autofill the output using IF functions. For one of the Outputs, i need to the information in the cell to be in a table format. I thought inserting an image would be easier than embedding a table, so i tried that. Cant get it to function tho.
I have tried the following:
If input6 = "putimagehere" Then
Dim img As String
img = "Image path"
table2.Cell(18, 3).Select
Selection.InlineShapes.AddPicture img
End If
It recognises the tables, all other putputs are correct, just the one that requires the image.
Any thoughts?
I have some defined shapes in a Visio 2010 stencil, and would like to set the layer depending on the value of a particular shape data field. I would like to do this within the shapesheet if at all possible, since my workplace is very limiting concerning the use of VisualBasic.
I can do the necessary look up to find a particular value, but need to translate this to the correct index in the page layers list.
Basically, I need to get the current index of a particular layer. For example, I know the name of the layer is "Remove" and need the index in ThePage!Layers so that I can set LayerMember accordingly. The index changes from page to page, so I need do this lookup in the context of the page after the shape has been dropped on the page.
How can I look up the index of an entry in ThePage!Layers, using the name of the layer as lookup index. A syntax like ThePage!Layers.Index["Remove"] doesn't work and I couldn't find any other information in the Microsoft documentation.
It is possible! My method
i add to my shape 3 sections: User-definded cells, Shape Data, Layer Membership.
In Shape Data section i create one row, which contain Layer Name selector
User-definded cells section contain two rows:
1. User.L_List store list of all layers on page. I prepare this list use MS Excel
In column A i fill row numbers, like as at this picture
In cell B1 i place formula - Concatenate("ThePage!Layers.Name";A1)
In cell B2 i place formula - Concatenate(B1;"&Listsep()&ThePage!Layers.Name[";A2;"]")
And pull down some rows as i need.
Select bottom cell in column B and copy that value
Paste this value in MS Visio's cell User.L_List
2. Next cell contain formula SETF(GetRef(LayerMember),LOOKUP(Prop.LayerName,User.L_List)),
which assign shape to layer according value in Prop.LayerName cell
I would like to insert a variable in a textbox in PowerPoint by use of an Excel macro. The variable must refer to a Excel cell and be updated whenever the excel cell value changes.
I have already tried OLE objects, linking and embedding.
Any suggestions?
Thanks in advance
Do you want to replace the entire contents of the text box with the contents of the Excel cell? If so, you can use the name of the text box shape to point to the cell ( ie, name the shape "C1R4" or the like). Or add a tag or tags to the shape to accomplish the same thing:
With oSh
.Tags.Add "Row", "42"
.Tags.Add "Col", "5"
End With
It gets trickier if you want to replace just some portion of the text within the shape:
2017 projected sales: [value from Excel goes here]
You can still do something like:
2017 projected sales: ##R42C5##
where ## delineates a "placeholder" bit of text that you'll replace with a value from Excel.
But that's a one-shot deal ... once you've replaced the text, you can't come back later and re-do the replacement. You may not NEED to. But if so, you can again resort to tags. Tag the shape with a tag whose value is "2017 projected sales: ##R42C5##" then use the tag value to replace all the text in the shape and then do the substitution with the text from Excel.
I have made a large diagram of made by shapes with numbers stored inside as text and need to change the "old" numbers to a "new" range of numbers. On each of the 20 sheets there are circles, Rectangles, Left Arrows and Right Arrows. The old range of numbers are stored on a separate spreadsheet in the Column "A" and need to be changed to the numbers listed in Column "B" (as in A1 to B1).
What would a VBA method to change the old text inside the Shapes to the new correct text based off of a new range of numbers? Is it possible to write a script that changes the values in the entire WorkBook?
My incorrect way of thinking is to:
1. Search inside the diagram to find the various shapes.
2. Get the text inside each shape.
3. Compare the text with the spreadsheet with the old numbers.
4. Insert the new number.
5. Move onto the next shape.
Put a value in A1 and say we already have a Shape:
Running this:
Sub LinkCellToShape()
Dim sh As Shape
Set sh = ActiveSheet.Shapes(1)
sh.DrawingObject.Formula = "=A1"
End Sub
will link the text in the shape to the value in the cell. You could also use:
sh.OLEFormat.Object.formula = "=A1"
I have a cell in excel which contains a value, lets say 100000.
Now i want this value to have commas in between them to represent the thousands and millions i.e. 100,000. I can do this by changing the number format in the home menu.
Now i want this value to be copied from that cell and paste it as a label for a shape. When i am doing this the commas go away showing me just the numbers.
I want it to happen through VBA but this is not happening in excel itself.
Does anyone have a plausible solution for this?
In range object use Text property, like this:
Sheet1.Shapes(1).TextFrame.Characters.Text = Range("A1").Text