Bulk Database Refresh multiple Visio Drawings?

  • Thread starter Phillip R. Olstein
  • Start date
P

Phillip R. Olstein

Step 1) Have the url hyperlink on a Visio Shape be from a field in a
database.

Already done. I can open access and change a value in a field, then
go to Visio, refresh database, and save as a web page.

Step 2) Now, I want to start cranking out network diagrams, using this
method.

How can I code something to go through a directory of Visio drawings,
open each drawing, refresh the database, save drawing, and save as a
web page?

I plan on coding in VB6 if it helps. I can handle going through a
folder easily enough, but I'm not farmiliar with Visio's VBA library.

Thanks for any help!

Phil
 
P

Phillip R. Olstein

It occurs to me, I can Visio do the refresh database on opening the
drawing. So the code should be open diagram, save, save to web page.

I found the references, including a savetoweb reference - still
working on opening a drawing - I'm getting activex errors now.
 
P

Phillip R. Olstein

Sorry to be replying to myself, but after finding this code from many
people in this group, I now have this:

---
Dim strFilePath As String
Dim strWebFilePath As String

Dim appVisio As Visio.Application
Dim docsObj As Visio.Documents
Dim docObj As Visio.Document

Dim vsoSaveAsWeb As VisSaveAsWeb
Dim vsoWebSettings As VisWebPageSettings

strFilePath = "C:\Test.vsd"
strWebFilePath = "C:\Test.htm"

Set appVisio = New Visio.Application
Set appVisio = GetObject(, "visio.application")
Set docsObj = appVisio.Documents
Set docObj = docsObj.Open(strFilePath)

docObj.Application.AlertResponse = 1
docObj.Application.Addons("Database Refresh").Run ""

Set vsoSaveAsWeb = appVisio.Application.SaveAsWebObject
Set vsoWebSettings = vsoSaveAsWeb.WebPageSettings

With vsoWebSettings
.StartPage = 1
.EndPage = 2
.QuietMode = True
.TargetPath = strWebFilePath
End With

vsoSaveAsWeb.CreatePages

docObj.Save
docObj.Close
appVisio.Quit
---

Now I just need to open the drawings hidden, and write a routine to go
through all the visio drawings in a folder.

Anyone want to point out the un-needed lines?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top