Hi,
I have developed a VB6 programme which is able to change the Fill Pattern of the shapes in a Visio Files.
But the problem is:
- I have to use Visio 2003.
- The files are ceated using Visio 2002.
- While running the code, it throws the error when I am using Application.AlretResponse to default save Current Version.
- It throws the error. "Cancel".
- I have to update thousands of Visio 2002 files, whose Fill Patterns needs to be updated. So don't want to save to files to Visio 2003 manually.
- I'll have to any how update/save these files to Visio 2003, programmatically.
- Any code in VBA or VB6 or VB.NET will help me a lot to proceed.
Please have a look into code below:
Sub ChangeFillPattern()
' Set numbers for each shape on all the pages of all the documents within a directory
' The changes are done in a temporary directory in case a problem arises.
Dim docObj As Visio.Document
Dim shpsObj As Visio.Shapes, shpObj As Visio.Shape
Dim i1 As Integer
Dim PathFileName As String, PathName As String, CurrFileName As String
Dim curPageIndx As Integer, curShapeIndx As Integer ' Loop variable
Dim ShapesCnt As Integer, ShapeLevel(200) As String
'On Error GoTo ErrHndlr:
'On Error Resume Next
' Set the default pathname
PathName = "C:\VisioTemp\"
PathFileName = PathName & "*.vsd"
' Find the first file from the directory (not necessarily the first alphabetically)
CurrFileName = Dir(PathFileName)
Do While CurrFileName <> ""
' Open the file
PathFileName = PathName & CurrFileName
Set docObj = Documents.Open(PathFileName)
Set pagsObj = docObj.Pages
docObj.Application.AlertResponse = 6
docObj.Save
docObj.Close
CurrFileName = Dir
Loop
'ErrHndlr:
'MsgBox Err.Description
End Sub
Post by DTranHi,
I'm trying to run a macro that worked perfectly in Visio 2002, but when I
An exception occured."
That, or where it says "... An exception occured.", it will say "Cancel."
When I hit the "Debug" button, it's always highlighted to the line with
"variable.Save". So is saving in Visio 2003 different than saving in 2002?
Any insight?
Post by Paul HerberOn Mon, 22 Dec 2008 11:15:05 -0800, DTran
in Visio 2003 save the file manually, ensure you save in Visio 2003
format, then try your macro. What might be happening is that the file
is in Visio 2000/2002 format and Visio is trying to ask you whether
you want to update the save format.
--
Regards, Paul Herber, Sandrila Ltd.
Electronics for Visio http://www.electronics.sandrila.co.uk/
Post by DTranYes, that was exactly the problem. I just figured it out myself, but thank
you very much for the prompt reply.
Post by Paul HerberMarvellous!!!
--
Regards, Paul Herber, Sandrila Ltd.
Electrical for Visio http://www.electrical.sandrila.co.uk/