Converting Visio numbering into plain text.

Started by Michael, December 24, 2010, 06:07:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Michael

OK. I've got a large file of over 4,000 pages. For many of the shapes while I was building the file, I used Visio's numbering function for the shapes. This worked OK but it's causing me problems exporting the pages for use in Casewise - the numbers appear as an "obj"- basically Casewise doesn't recognise them and calls them "an object" - end of. I'd like some way of converting all the text in the shapes to unformatted text (so it takes on the default properties).

I'm using Casewise as a step to HTML because Visio crashes/hangs when I use the normal "Save as Web page" function. I've got Paul's alternate webpage creator running on another copy on my laptop but that's taking an average of 2 minutes per diagram so may not be complete this year...

Also, I've used the page name field in some shapes and, although this isn't quite so crucial as they are temporary markers, it would be nice to convert those to plain text, too.

I suspect I'd need to do this one page at a time - or in batches of 10/50/100 - at 82.4M I run into memory issues with many batch programs.

JuneTheSecond

#1
Next macro destorys all text field data on 4000 pages such as numbering, and convert into simple text.
Please, never forget to backup your important drawing.



' Warning!
   ' This macro destroys text feild data in all shapes on a Drawing, and write text.
   ' Don't forget to backup the drawing.
   
   Dim pg As Visio.Page
   Dim shp As Visio.Shape
   Dim myText As String
   If MsgBox("Do you really replace all text fields into simple text?", vbYesNo) = vbNo Then Exit Sub
   If MsgBox("Please confirm once more.", vbYesNo) = vbNo Then Exit Sub
   
   
   For Each pg In ActiveDocument.Pages
       For Each shp In pg.Shapes
           myText = shp.Characters.Text
           shp.Text = "xxx"
           shp.Text = myText
           Debug.Print shp.Text
       Next
   Next


Best Regards,

Junichi Yoda
http://june.minibird.jp/

Michael

Junichi,

Thanks. I heeded the warning (always welcome) and ran the macro on a copy of one of the smaller files I created from the larger file and it worked a treat.

Amazing how something so simple can solve a seemingly difficult (i.e. tedious) task/problem.

My thanks again.

Michael.