Rotate shape and not set on background pages

Started by astrahim, September 15, 2015, 05:06:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

You took Al too literally.  The double quotes go around the ""90 deg"", not the word formula.  Leave formula as it was, no quotes.

Actually, as I recall, preferred is to replace the outer quotes with chr{34}:  chr{34} & "90 deg" & chr{34}.

Also, I think there needs to be a space between the 90 and deg.

Wapperdude
Visio 2019 Pro

astrahim

Still not happening for me guys.

Here is what i am getting now.

wapperdude

Go back to the capture.png case and remove the SET in front of your formulaU code line.

Wapperdude
Visio 2019 Pro

astrahim

still getting the same errors either way i try to input the formula. Any other options?

wapperdude

#19
OK.  My bad.  Didn't go thru your code very thoroughly.

You need to set your Title shape before you put something into its angle cell.  Code sequence should be as follows: Set shpPageTitle = Documents(1).Pages(i).Shapes("SheetTitle")
shpPageTitle.Cells("Angle").FormulaU = Chr(34) & "90 deg" & Chr(34)


Note, the chr(34) should be regular brackets as shown here, not the "{,}" I showed previously.

Wapperdude

edit:  added missing ")"
Visio 2019 Pro

astrahim

I think that has fixed it. Thanks a lot Wapperdude.

Now I am getting this error though.

wapperdude

Have you tried stepping thru the code using f8.

I'm a little concerned that the first "SET" statement for the master is not right.

Visio 2019 Pro

astrahim

#22
yes, i have gone through the code with f8 and it stopped at the line i just added to rotate the object.

what do you think should the master statement should be?

wapperdude

First:

step thru your code with f8, execute the SET master line.  Then, hover the mouse over the mastObj object.  Is it set to the value you were expecting, i.e., "SheetTitle"?

Second, keep stepping thru the code but, don't execute code line that sets the rotation angle value.  Now hover over the shpPageTitle object, and verify that parameter is set to what you'd expect.  Then, open it's shapesheet in the drawing window, and verify that it has an angle cell, and that the contents are not guarded.

Third, keep the shpPageTitle cell selected, and, I'm assuming that you've tiled the drawing and vba windows. Also, keep the shapesheet open, and scroll to the top so you can see the angle cell.  Note, you should also see a value for angle in the Size and Position Window.  If everything looks fine, then, the next f8 ought to execute the code.    Which you say fails.

So, copy your code as it exists, and paste it into your next reply so I can see it exactly... When you re-ordered the "Set shpPageTitle" and "shpPageTitle.Cells" code lines, you did also keep the "I=pagObj" before the "Set shpPageTitle" line? 

Line sequence is critical for successful code execution.

Wapperdude
Visio 2019 Pro

astrahim

This is awesame, thanks a lot for taking time to help me out.

so when i hover over mastObj, it sais "mastObj = Nothing", how do i set it to "SheetTitle"?


wapperdude

#25
What exactly are you trying to accomplish with the mastObj?  It seems you have redundantly defined SheetTitle:  mastObj, shpObj, and shpPageTitle.  Why so many similar definitions?

Second, here's a reference about getting a Master shape.  Note, the code example has an error, which I've corrected below: https://msdn.microsoft.com/en-us/library/office/ff766060.aspx .  Not sure this is what you are really after, so make sure your read what's going on.

Public Sub OpenMaster_Example()

    Dim vsoMaster As Visio.Master
    Dim vsoMasterCopy As Visio.Master
    Dim vsoShape As Visio.Shape
    Dim vsoCell As Visio.Cell

    Set vsoMaster = Visio.ActiveDocument.Masters(1)
    Set vsoMasterCopy = vsoMaster.Open

    Set vsoShape = vsoMasterCopy.Shapes.Item(1)

    Set vsoCell = vsoShape.CellsU("FillForegnd")
    vsoCell.Formula = 9

    vsoMasterCopy.Close

End Sub


Here's another link where VisioGuy provides a detailed explanation about editing Master shapes:  http://www.visguy.com/2008/02/25/edit-visio-masters-programmaticallythe-right-way/

Wapperdude
Visio 2019 Pro

astrahim

I'm trying to have a sheet title be inserted automatically every time there is a new sheet added to the project. and after that command is done, the second part is to have that sheet title show up on the very first page of the project as well as a sheet number next to that title. Keeps track of all sheet automatically, just do a simple update every time i save the project.

Thanks, I will try this method and see if that will work.

~A~

wapperdude

Ah.  For what you're trying to do, you might want to search this forum for table of contents.  I think there's many entries on that topic.

I did remember this entry, might be useful. http://visguy.com/vgforum/index.php?topic=4171.msg16270#msg16270

Wapperdude
Visio 2019 Pro

astrahim

this is very good info. essentially, my code does the same thing and also adds a description of each page which i have to give the description of each page. but the title page will write that description automatically.

now, i have created a new title block for my new standard template and want to add the rotate text to 90 degrees, that's whats so difficult to do for me.

see picture of the title page and what this code does. If i could find a simpler code that does the same thing, that would be even better. but it's set up the exact way i want it at this point and don't want to fix what is not broken in a sense. Just wanted to add the rotate 90 deg to the text being inserted on each page so would be more automated.

Thanks,
~A~