Add New Tab After Currently Active Tab?

Started by stimbo, November 18, 2008, 04:21:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

stimbo

One of about 100 things which really make my life difficult with Visio is when i have a large number of tabs (70+) and i then need to add an additional tab in between tabs 20 and 21 for example. I can't simply (or at least don't know of a way) right clicking on tab 20 and from a context menu have an option that says "Insert after current tab..."

I am so sick of having to manually organise the tab to where i want it from the end of the queue. Would it be at all possible to do this via programming?  Thought i'd ask first before wasting too much time. I have some macro writing experience but not with Visio so don't know what's possible.

Thanks for reading.

Stim

stimbo

I found some that did the job in a macro:

Dim currPage As Visio.Page
Dim newPage As Visio.Page

Set currPage = ActivePage
Set newPage = ActiveDocument.Pages.Add
    If Not (currPage.Background) Then
        'if current page is a background page, don't set index
        newPage.Index = currPage.Index + 1
    End If
   
I just need to figure out how to set a macro to run all the time but that shouldn't be too difficult... :)

Paul Herber

I certainly agree that it would be a very useful feature, in fact I think I'll add such a feature to my utilities. Creating names for the pages would be interesting, should the names relate in some way to where they are inserted or just numbered in sequence from the current last page?
Whatever is done is very fraught with problems as each page has a Name and a NameU, i.e. its local name and its universal name, these can be different, in fact it's possible to have a 2 page document with the 1st page Name = "Page-2" and NameU = "Page-1" and the 2nd page Name = "Page-3" and NameU = "Page-3". Inserting a page between page 1 and page should be called what?

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

stimbo

I always rename my tabs so i'm not sure what the answer would be to your question but i see what you are saying. It might cause some people an issue. There doesn't seem to be a way for me to create a macro that's always remembered. It has to be tied to a particular document. Is this correct? If so the only other option seems to be to write a COM add-in which looking at the documentation doesn't appear to be massively easy.

I would in fact ideally really like either a tree view to organise my tabs into smaller groups or a power point style UI so that i can at least easily visual identify some of them by their elements although the tree would be my fav by quite a long way. Dealing with tabs is just a nightmare when you get any number of them. Completely inefficient like most of Visio.

If you know the answer to the macro question or an easy way to make the functionality available to Visio (not just a specific file) then i'd love to hear your thoughts. I'm new to all of this and although willing to dig into code etc... I'd appreciate any knowledge you can share on this topic.

S


wapperdude

I don't think you need to renumber the tabs.  Excel doesn't when you do add Worksheet, which it does by adding it to the front of the stack, less logical since it's out of sequence.  Once added, Excel gives you the move option to select the position you desire.
Visio 2019 Pro

stimbo

I've got a COM Add-in now that adds the tab to the next position or previous tab position.  :)





wapperdude

Care to share?   ???  I suspect there might be a lot of interest.   :o
Visio 2019 Pro

stimbo

There's a bit of a snag,

it's working fine with Visio 2007 as far as we can tell but I'm not having the same joy with Visio 2003. There doesn't appear to be any reason for this that I can find. The code is executing just fine. :(   

I'll post later if/when there's a solution for 2003.

S

stimbo

#8
Okay,

after an absolutely mammoth attempt to get this working it's... generally working perfectly. The issues turned out to be problems caused by other add-ins which I had in Visio like the Adobe PDF add-in and my Bluetooth driver. There are a large number of other reports of these sorts of situations causing issues on the internet. It has caused massive havoc in trying to get this to work. The only way i could get this to work on my particular laptop in the end was uninstalling the bluetooth driver and removing the Adobe add-in for Visio. There are instructions at the bottom of this for additional things to check for to help with this removal if you need it. On other laptops there was no need to do this. You might be lucky and not need to remove the bluetooth, i think it just depends on make and model. So try the normal stuff first and if you want to take it further then it's up to you. It worked on another laptop without any need to remove bluetooth.

I want to make a couple of things clear: (the two zip files needed are 2 posts below this one)
1. This add-in has two features. The first is to create additional menus on right click over a tab so you can simply add tabs before and after the current tab.
2. This add-in will also change the default behaviour of Copy/Paste in Visio. This was something else I was sick of. So now, Ctrl + C and Ctrl + V will copy and paste in the same place, like PowerPoint does. Ctrl + Alt + C or Ctrl + Alt + V will copy/paste like the default Visio behaviour. If you don't like this then... don't install it.   
3. My friend James M did all the hard work and tracked down all the issues so i can't take any credit for it. If this works for you and you like it then you owe him a pint. :)

Here are the instructions for getting this to work. Use this at your own risk. There's no warranty with it.

Make sure Visio is closed before you start! 

Requirements: (download and install in this order if you don't already have them)
1. .NET 2.0 Redis
2. Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (build 8.0.50727.940)

If you have Office 2003 then you will most likely need the Interop Assemblies:
Office 2003 PIA

If you have Office 2007 might already have then so might not need them but you can get it from here if you need it:
Office 2007 PIA


Installing the files:

Next, download the 2 zip files (see posts below) and extract the reg zip files contents:

If running Windows XP you can simply:
Run the 3 reg files by double clicking on them in order 1.reg, 2.reg, 3.reg

Then, you MUST create a path:
C:\Program Files\Red Gate\Visio\

and place the 3  files from the second zip file: (AdditionalMenus.dll; AdditionalMenus.dll.manifest; AdditionalMenus.pdb), into the C:\Program Files\Red Gate\Visio\  directory

If you are running Vista you will need to :
firstly open the reg files 1 and 3 in Notepad and change the line specifying the Manifest directory (C:\\Program Files\\Red Gate\\Visio\\) to whatever directory it is you want to install the dll files from the other zip file. Note the use of the double \\   This is on purpose and you need to adhere to it. Change the directory to whatever you want in the 3 reg files and save the changes. Then you can register the 3 of them by double clicking, and then put the 2 dll files and pdb file from the other zip file mentioned above into the directory you have just specified and created.


Increasing the security to allow it to run
You need to now manually raise the security policy for the AdditionalMenus.dll file to allow it to run:

1. Go to Control Panel ->
2. Administrative Tools ->
3. MS .NET 2.0 Configuration ->  (If this isn't present you need to download the SDK; .NET 2.0 SDK)
4. Configure Code Access Security Policy ->
5. Increase Assembly Trust ->

A wizard pops up at this point. Make sure the following options are selected:
1. Make changes to this computer   ->
2. Browse to the directory where the dll is stored (e.g. C:\Program Files\Red Gate\Visio\AdditionalMenus.dll , click next ->
3. Choose the "All assemblies with the same assembly public key" option.
3b) make sure you UNCHECK the "include version number" option (this is important) ->
4) Make it "Full Trust"
5) Finish

That's it really. When you open Visio you hopefully will have the additional functionality.

This wasn't necessary for me but one of my colleagues using XP had to open Visio, go to Tools -> Options -> Security -> MacroSecurity ->  Set it to Low. In 2007 it's slightly different (Trust Center -> Add-ins ->) but you might need to grant the COM add-in low security to run so try changing the settings if they are too restrictive. Check around for granting this COM addin access to run. It seems to be quite important for some cases and if it's not working it's most likely because of permissions (or Bluetooth/adobe/additional add-ins).





-------- Additional trouble shooting stuff --------------

If you are having trouble with this and want to investigate further and have blue tooth or Adobe plugin installed in Visio and want to remove these then you might need to use the Add/Remove programs to remove the Bluetooth driver if you find this isn't working (although there's always the chance that it's something else.

Then open a Find and search for all files with extension:  *.vsl

I had to change 2 files called (you may see more references to Visio from other files which you may also want to change):
PDFMVisio.vsl  (This was the Adobe pdf maker add-in. I just changed it to: PDFMVisio.vsl_OLD)
btsendto_visio2k.vsl  (changed to: btsendto_visio2k.vsl_OLD) - this was a bluetooth file but you may not need to do this.

There are a number of reports of heavily customised menus causing problems for COM add-ins. I didn't have to but I went to the Detect & Repair option and reset my installation (takes about 4 minutes) so it reset Visio back to its original configuration but this might not do anything. Just mentioning it.

stimbo

#9
Me again,

my friend James has created a really funky additional add-in (see picture).

It's a tab preview with selection ability. You can use Ctrl + t to bring it up (it's also available from right clicking on the tabs). Simply double click from the list for which tab you want to jump to.

Hitting the return key also selects as well as double clicking. The ESC key dismisses it. It's a little slow the very first time you bring it up but it's nice and fast after that.

See the post above for instructions on how to install (both zip files needed are in the next post due to a bug fix which had to be done regarding copy/paste). These files have the functionality mentioned in the previous post plus this new preview functionality. Just replace the dll files and pdb files mentioned above with the ones in this post and you will have the additional feature. 

This really is very cool and will allow me to jump quickly between my usually large number of tabs.

Enjoy!

S

stimbo

Here are the two zip files needed with the add-ons and reg files.

They had to be updated due to fixing a small bug in the copy/paste behaviour when selecting an object versus selecting just text.

S