johnvisiomvp

Life with Visio and other Microsoft Toys!

Why are #Visio H&Fs so Lame?

leave a comment »

This question came up recently and though I have insisted that Visio authors mention that background pages are the Visio way, this goes into more detail.

Word has had the ability to add special text at the top and the bottom of the page called Headers and Footers. They contained information like dates, page number, number of pages and various text like titles for sections or chapters.

In Visio, it was different, the original and the Visio way to handle this information was background pages. The background pages contained information in a title block you wanted to be placed consistently on the foreground page. Each foreground page could contain several background pages. There may be information you want on all pages or information you only want on certain pages.

In the pre computer days, engineering drawings were created on large format vellum paper, a translucent paper. The draughtsperson would create the drawing with dark ink using a T Square, 45s and 30-60s(these are triangles) and other drawing aids. The T Square allowed the draughtsperson to create perfectly horizontal lines and the 45s and 30-60s vertical lines. The 45s also allowed for the creation of consistent hatch marks and the 30-60s helped to create perspective drawings.

To create the consistent title block, the draughtsperson would place a sample title block behind the vellum and trace it. This is where the concept of foreground/background pages came.

The drawing was printed by placing the vellum on top of a light sensitive page and running it through a machine that exposed it to a bright light and then ammonia. That was one of my tasks I had as a summer job (changing diapers is not a problem for me)

Headers and Footers were added  to Visio in version 3 because of a request from a large engineering firm. Most office apps print on a single page size, Visio allows you to make a drawing large than standard page sizes and print them on the same size paper or on several physical pages  by tiling the drawing. The firm wanted to print oversized drawing on standard letter size paper and have header and footers like Word to be printed on the individual pages.

So, Visio added the bare minimum. For most Visio drawings, they are not tiled when printing, so H&Fs are redundant, but when they are tiled it does give you the ability to mark each individual page.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Advertisements

Written by johnvisiomvp

August 8, 2019 at 11:20 am

Posted in Uncategorized, Visio

Tagged with

Cruise runs aground

with one comment

While I was creating the cruise demo, I ran into a problem removing the data source from the connected data. I had created the drawing and tried it as a data connected diagram and went back and tweaked the drawing. Since I wanted to start the demo with a clean diagram I tried to remove the reference to the source Excel file. I have done it several times on other drawings, You right click the External Data window and the last item in the drop down is Data Source. Select that and the drop down give you a Remove option. This will produce a warning dialog asking if you really want to do that, but in this case when I clicked, the drawing hung with a (Not Responding) tag. I went and had lunch and it was still hung.
Since a Visio drawing file is the same as other Office apps, a zipped version of a directory of XML and other files, I tried to unzip a test file to see if I could manually remove the reference. That only produced a corrupted file when I compressed and renamed the file.
It turns out the solution was easier than I thought. Just Cut and paste.
I selected the shapes I used, did a copy and then pasted into a new drawing. Visio was smart enough to know I was copying shapes that were part of linked drawing and asked.
“The pasted shapes were linked to data that is not in this document. Do you want to also paste the missing data source?”
A simple “No” solved my problem.
Now that I am off the rocks, I will continue working on the cruise demo.
I still have the problem file if the Visio team wants to figure out why it hung.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

August 3, 2019 at 2:40 pm

Techniques for creating Visio Shapes

leave a comment »

Most Visio users barely scratch the surface when dealing with the product. I recently watched a video where a Visio expert dropped a shape on a page and then used the Text tool to create a label for the shape. All Visio shapes have a text block and there is a Text block tool if you do not like the positioning or orientation of the text, you can change it. So, why is that a big deal? Visio is a database of information and if you want to create a report on the Visio drawing, the label will not be associated with the shape, it will be a separate shape.
A lot of Visio users are unaware of the Shapesheet and can survive without that knowledge. The techniques I an going to show do not require using the shapesheet, but a little peak under the hood with a Shapesheet will help you understand what is going on.
Developer Mode If you are going to be creating shapes, you should turn Developer Mode on.
File -> Options -> Advanced -> (scroll to the bottom) Check mark  Run In Developer mode
or
File -> Options -> Customize Ribbon -> on the Main Tab Check mark  Developer
You will have access to the Developer ribbon with Operation commands and a few other goodies.
Shapesheet The shapesheet is a way to view the internal structures within a Visio drawing. In addition to a view of a shape, there are shapesheets to see some of the internals for the Visio page and the Visio document. The shapesheet is divided into sections and each section is a table of values or lists of rows of values. Most sections are unique, but the Geometry section may have several.
Image Source So, how do you create shapes from scratch to create a Visio drawing? First find a drawing you can use as a template that has the right proportions or dimensions. Should it be a vector or raster image? Vector would be nice, but sometimes it causes more problems than it is worth. what may look like a rectangle could be a set of four disconnected lines. I did a series of flags and the stars were actually triangles. Luckily Visio allowed me to select the star field and use the Union operation to simplify the stars. The result was a group of individual stars. Then there is the time taken to remove superfluous shapes. So, unless I get quick results with vector diagrams, I go with raster.
“Template” (old school definition) Visio will allow you to drop most image files into a Visio drawing, I then put them on a locked layer and use them as a template (old school definition) to draw the shapes with basic geometry shapes. I build up a collection of rectangles, circles and other basic geometries. With the Visio operations you can create some interesting shapes, but you have to plan the operations. Should you Union first or Fragment?
Scaling Visio is an engineering drawing tool and understands dimensions. When dealing with shapes with known dimensions, you need to be able to resize your “template” so it is the proper size. I have done this by adding a rectangle that has text that displays the rectangle’s height and width and placing it over something with a known dimension. Select the template and the rectangle and stretch (keeping the aspect ratio fixed). when the dimension in the text block matches the desired value, you have the right size. I have also written VBA code that sets the templates size by using two reference rectangles. One is set to a known distance on the template and the other is set to the actual dimension. The VBA code works out the ratio of the two rectangles and applies it to the template.
Basic Geometry shapes You can use the Pencil tool to create a shape, but it will be difficult to keep the lines straight and the angles of the line correct. It is far easier to lay out a set of overlapping rectangles and circles and then use the Union command to get the desired shape.
Gaps If you put two shapes adjacent, but not quite, you may get a gap between the shapes when you do a Union. Undo the Union and put a rectangle as a patch bridging the two shapes. The patch does not have to cover the full gap. It is not worth the time trying to get the patch perfect. Reselect with the patch and redo the Union. Rather than a gap you will have two fingers that can be easily fixed with the Pencil tool. Use the Pencil tool to select the corners of the fingers and delete. The Pencil tool can delete any other unwanted points.
Rounded Corners If you want a rectangle with rounded corners, you can draw a rectangle and then chose Line -> Line Options… ->and set the Rounding size. Then Developer ->Operations -> Union. This may not seem to do anything, but if you had looked at the shapesheet before and then after, the Geometry section would contain a RelMoveto and three RelLineTos, afterwards they would be interspersed with EllipticalArcTos and the Rounding setting in the Line Format would go from non zero to zero. You can do it to only some corners by duplicating the shape, align the two shapes Center and then Middle and just select the top shape and set the rounding on that. Select both shapes and do a Fragment. Delete the unwanted corners and then select the shape and the wanted corners and Union.
You can also create inside corners by placing a circle inside a larger square, centering them and then use lines to bisect.
Parallel Lines Having stripped shapes is common, making them is easier. Draw a line, duplicate it many times. Select the lines, align on center and then Distribute. You can then Join or group the lines.
Matching Curves  Trying to make matching curves is not easy. On one project I had to make a cylindrical shape that was intersected by a smaller diameter cylindrical shape. It was a container with a spout that went off at an angle. So, I created two rectangles and resized and positioned them appropriately. The smaller diameter cylinder overlapped the large diameter cylinder. I duplicated the smaller diameter cylinder and aligned the two copies to the same place. I selected the larger cylinder and a copy of the smaller diameter cylinder and did a Union. I then used the Pencil tool to remove the ends of the smaller cylinder from the large cylinder. What I was left with was what looked like the larger cylinder, but one of the side walls had two points at the location where the two cylinders intersected. Using the Pencil tool I was able to bow that section to make the intersection visible. I duplicated the larger cylinder and aligned them to be in the same place. I then took the copy of the larger cylinder with the smaller cylinder and did a Fragment. I then had a spout with a matching curve to the large cylinder. I then deleted the remaining part from the Fragment operation.
Groupies When shapes are grouped, a new shape is created and the selected shapes become sub shapes of the group shape.  Grouping is very useful for keeping subshapes together, but you can get carried away. When your shape is ready, you should go back through the shape and remove any non essential grouping. Actually, you probably should remove all groupings and select all the component shapes and group. Then add things like Shape Data and Control handles and Connection points. You may want to keep a backup copy of the shape with the groupings if you need to rebuild.
Connection Points The normal connection points handle standard situations, but what if you are creating a piece of electrical equipment and you want the connection points to be where the wires connect? Use the Connection Point tool.
Cleanup When you have finished your shape, you should remove all the Groupings and Creating a new Group of the parts. Then add Shape Data.
Almost Black My favourite technique is still Graham Wideman’s almost black. If a line or fill colour in a custom line patter or custom fill is black, it is replaced by the chosen foreground colour. If you want something to be black, it needs to be something that is almost black(255,255,25) like (254,255,255) or (255,254,255) or (255,255,254)

The next set of techniques in a followup article, will go into leveraging the shapesheet.
If you want to learn more about Visio shape developing, check out Chris’s Visio Guy website there are a lot of articles and forums to handle questions.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

July 28, 2019 at 2:04 am

Posted in Shapes, Visio

Tagged with ,

Adding Shape Data to a series of new shapes

leave a comment »

I have been playing with Visio Visualization in Power BI and the first step is to create a Visio drawing. Basically it is a bunch of shapes, but I need to add Shape Data to the new shapes, basically the key that will link the shape to the row of data in Excel. I could select each shape and then set the shape name and create the shape data, but I am lazy, so…

Again VBA was useful.

So I used the following code to go through selected shapes, change the text on the current shape to “X” so I can see which shape I am about to change. The ShowChanges line makes the change visible.

I then prompt the user for the name they want to apply to the shape and use that to set the name of the shape. I also boost the font size so that it is more visible. I then go through and delete the shapes properties if they already exist so I can start with a clean slate. I then add the Shape Data field I will use as a key to the shape. The other fields will be added as Visio makes the data connections using the key. I then set the text for the shape to be the shape’s name.
I then deselect the shapes, so a new set of shapes can be selected.

Public Sub LoadCabins()
Dim Shpname As String
Dim vsoSelect As Visio.Selection
Dim vsoShape As Visio.Shape
Set vsoSelect = Visio.ActiveWindow.Selection
If vsoSelect.Count > 0 Then
For Each vsoShape In vsoSelect
vsoShape.Text = "X"
Application.ShowChanges = True
Shpname = InputBox("Enter the cabin number", "Cruise Line")
vsoShape.Name = Shpname
vsoShape.Cells("Char.Size").Formula = "=20 pt."
If vsoShape.CellExists("Prop.Cabin", 0) Then
vsoShape.DeleteRow visSectionProp, vsoShape.CellsU("Prop.Cabin").Row
If vsoShape.CellExists("Prop.Category", 0) Then
vsoShape.DeleteRow visSectionProp, vsoShape.CellsU("Prop.Category").Row
If vsoShape.CellExists("Prop.Type", 0) Then
vsoShape.DeleteRow visSectionProp, vsoShape.CellsU("Prop.Type").Row
If vsoShape.CellExists("Prop.Amenities", 0) Then
vsoShape.DeleteRow visSectionProp, vsoShape.CellsU("Prop.Amenities").Row
If vsoShape.CellExists("Prop.Connect", 0) Then
vsoShape.DeleteRow visSectionProp, vsoShape.CellsU("Prop.Connect").Row
iPR = vsoShape.AddRow(visSectionProp, visRowLast, visTagDefault)
vsoShape.Section(visSectionProp).Row(iPR).NameU = "Cabin"
vsoShape.CellsSRC(visSectionProp, iPR, visCustPropsLabel).FormulaU = """Cabin"""
vsoShape.CellsSRC(visSectionProp, iPR, visCustPropsType).FormulaU = "0"
vsoShape.CellsSRC(visSectionProp, iPR, visCustPropsFormat).FormulaU = ""
vsoShape.CellsSRC(vi7176sSectionProp, iPR, visCustPropsLangID).FormulaU = "4105"
vsoShape.CellsSRC(visSectionProp, iPR, visCustPropsValue).FormulaU=vsoShape.Name
Set vsoCharacters = vsoShape.Characters
vsoCharacters.Begin = 0
vsoCharacters.End = 5
vsoCharacters.AddCustomFieldU "Prop.Cabin", visFmtNumGenNoUnits
Debug.Print vsoShape.Name
Next vsoShape
ActiveWindow.DeselectAll
Else
MsgBox "You Must Have Something Selected"
End If
End Sub

Though this code can handle all the shapes at once, it is designed to handle smaller groups at a time. You do not want to accidently change shapes you did not intend on changing. In the process of creating the shapes, I did rerun the code several times.
So, this will help me populate a Visio drawing with data that Visio can use to link to an Excel spreadsheet and load extra data. I am in the process of writing the three articles that will explain the Visio visualization in Power BI demo I am planning on building. The first will be the creation of the Visio drawing and the considerations involved, the second will be lighting up the drawing in Visio using data connectivity and the final article will be using that Visio drawing in a Power BI dashboard.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

July 24, 2019 at 2:33 am

Posted in Power BI, VBA, Visio

Tagged with , ,

Removing unwanted properties from a collection of masters

leave a comment »

In addition to cleaning up how the masters looked, I also had masters that contained user and custom (AKA Shape Data) properties that were no longer needed.

Again VBA was useful.

So I used the following code to

Public Sub CleanMasters()
Dim vsoMaster As Visio.Master
Dim vsoMasterCopy As Visio.Master
Dim vsoShape As Visio.Shape
For Each vsoMaster In ActiveDocument.Masters
If vsoMaster.Type = 1 Then
Set vsoMasterCopy = vsoMaster.Open
Set vsoShape = vsoMasterCopy.Shapes(1)
If vsoShape.CellExists("User.Class", 0) Then vsoShape.DeleteRow visSectionUser, vsoShape.CellsU("User.Class").Row
If vsoShape.CellExists("Prop.Link", 0) Then vsoShape.DeleteRow visSectionProp, vsoShape.CellsU("Prop.Link").Row
vsoMasterCopy.Close
End If
Next vsoMaster
End Sub

For Custom Properties (AKA Shape Data), replace “User.” with “Prop.” and use the right name of the property and remember the section name is visSectionProp rather than visSectionUser.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

October 19, 2018 at 9:48 pm

Posted in Shapes, Uncategorized, VBA, Visio

Tagged with , ,

Clean up Visio Masters

leave a comment »

Anyone who has created Visio masters may have noticed that the masters may require cleanup. When selecting a master to edit, you may notice that the edit window seems to be empty and you  will need to center the image to bring it back in view. Other times, the shape is bigger than the page it is sitting on in the edit window. So, a little editing on the page shapesheet is required, either the values or grabbing the sides and readjusting.

I am not sure whether the cleanup actually makes a different, but it is less of a distraction when editing the masters.

Recently I was faced with the task of doing this cleanup to more than 500 shapes, so VBA to the rescue.

With a little research, I came up with

Visio.Master.ResizeToFitContents

So I used the following code to

Public Sub CleanMasters()
Dim vsoMaster As Visio.Master
Dim vsoMasterCopy As Visio.Master
Dim vsoShape As Visio.Shape
For Each vsoMaster In ActiveDocument.Masters
If vsoMaster.Type = 1 Then
Set vsoMasterCopy = vsoMaster.Open
vsoMasterCopy.ResizeToFitContents
vsoMasterCopy.Close
End If
Next vsoMaster
End Sub

So far this seems to work. I did notice that the page has a margin rather than being the same size as the master. No big deal. The key factor is that it is consistent.

Thanks JG for being a sounding board.

Enjoy…

John Marshall… Visio MVP Visio.MVPs.org

Written by johnvisiomvp

October 19, 2018 at 9:24 pm

Posted in Shapes, Uncategorized, VBA, Visio

Tagged with , ,

Microsoft MVP

leave a comment »

There are a number of articles on how to become an MVP and since is the 25th anniversary of the programme, I thought I should add my view and fill in some the background.

Last year Visio turned 25.  I have volunteered with the product team for 24 of those years, something that no other MVP can say so I am in a unique position to talk about the MVP programme.  I have haunted some of the same CompuServe forums with the original MVPs and I am honoured to be able to call them friends.

So, what is an MVP? The basic definition is a supporter of a Microsoft community.  In the early days, it was a product, but it has been expanded to services.  MVPs are not paid for their service but do receive a few perks like MSDN and some get togethers.  They are not Microsoft yes men (or women) and are famous for criticizing MS.  Of course, the criticism is not hollow.  It usually is well thought out and comes with reasons.

So, what does it take to become an MVP? In the early days, it was a matter of being a prolific poster on certain CompuServe forums.  Why CompuServe? In the early 1990s, a number of companies, including Microsoft, started to use CompuServe’s forums for customer support.  This was a switch from one on one support that was available only during office hours to group support that was available 24×7.  So, while waiting for a response, you could check out questions from other posters.  This is the start of the MVP program.  In addition to looking for solutions, people were providing answers.  Other than killing time, why would they do that? They liked to help.  They enjoyed a challenge in finding a solution.  They had been helped by others and wanted to pay it back.

In 1993 Calvin Hsia, a FoxPro developer who lived in Hawaii, thought it might be fun to figure out who posted the most on the CompuServe’s forum.  He then published a list of hundreds of the forum’s “Most Verbose People” as he liked to call them.

Microsoft saw value in that verbosity, so much so that the members of “Calvin’s List,” along with its creator, became Microsoft’s first Most Valuable Professionals (MVPs).

Initially, it was one person who thought that those who were helping out on the Microsoft forums deserved some recognition.  It was just a thank you post.  This idea was taken up by others at Microsoft, who on their own time, helped expand the list.  Eventually some of the recognized were invited out to Redmond to meet the product teams they supported.  This was the first MVP summit, a small group of volunteers who enjoyed helping their online communities getting recognition from Microsoft.

This was a grass roots movement and luckily, someone terminated the programme in 1999 because they thought that the access the MVPs were getting was a potential problem.  Over the weekend, those who were helped in the forums were quite vocal with Microsoft upper management and let their feelings be known.  The programme was quickly reinstated, but now they had the backing of upper management who remain a staple of the MVP summits.  The initial MVP staff ran the MVP programme in addition to their regular work.  With the reinstatement of the programme, they now had backing and support from upper management (and a budget).

Microsoft hands out awards for people who they believe excel at helping the various Microsoft communities.  It is not a certification that can be studied for and earned.

Initially the programme was based around a few products and the leads were based with those products, now it covers most of the Microsoft products.  (I am still waiting to meet the MS Bob MVP).  Regional MVP leads have been added to address the needs of those MVPs around the world.  The regional MVP leads need to understand the full suite of Microsoft offerings.  So even though they may not know the nuisances of a certain switch in your product, they understand your passion and will try and get someone to help with the answer.

So, why did so and so not get an award? Like the Academy awards, only so many can be recognized.  This does not mean that those not receiving an Academy award are terrible actors, just that the Academy saw something to recommend one of the others.  Also, the programme has been expanded world wide and it is an extremely difficult task for the MVP leads to evaluate all the recommendations they receive.  As far as I know, the MVP leads do not have a quota for having x number of Product Y MVPs in their area, but there are constraints on how large the programme can grow within their budget.  So, there are many reasons why someone was not awarded.

So why is there not a shopping list for MVP criteria?

 So, if I answer 500 or 1,00 questions, do I qualify? What is the quality of the answers? Is it a yes/no or does it have a detailed explanation or recommendation.  Obviously, quantity alone can not be a criterion.  Who is to say that talking to a user group of 25 is less important than talking to one of 3,000.  Since they are making money, should authors be excluded? A number of authors actually loose money writing about technical products, some actually do get rich.  Again, this is another criterion that is difficult to quantify.  If the criteria is quantified like other certifications, Then we will have people going for the award rather than helping the communities.  One year, several Office MVPs were not awarded because other individuals had higher answer counts.  On further examination it was found that some of the answers were not useful and were just there to boost the counts.  So, I hope that Microsoft keeps the award criteria a mystery.  Yes, the MVP leads are human and do make mistakes, but the selection process is not easy.

MVPs do not drink the Kool-Aid, beer whiskey or iced tea, maybe lots of coffee, but definitely not the Kool-Aid.

MVPs loyalty is to the community they support, it is not to Microsoft.  They love their product or service and Microsoft understands that.  The MVPs may complain, but Microsoft knows the complaints are not hollow and are accompanied by a reason of what MS is missing or doing wrong.  Of course, MVPs are not fallible, but MS understands that.

In the same vein, MVPs understands that there is competition and they do not provide hollow criticisms.  In fact, MVPs understand and appreciate the competition and for certain scenarios may recommend competing products.

MVPs are not always on pedestals.  Okay, there are a few that have a kiss my ring attitude, but they tend not to be the long-term MVPs.  They understand they do not know everything and try to encourage others to present/publish They are the ones at the back of the room asking leading questions to help novice presenters because at one time they were there and know friends in the audience helps.  They prefer to shine the spotlight on the product rather than themselves.  MVPs inspire others to learn.

Enjoy.

John Marshall… Visio MVP Visio.MVPs.org

 

Written by johnvisiomvp

March 29, 2018 at 5:45 pm

Posted in MVP, Uncategorized