Export to HTML by code

I

Igor G.

Thank's,
It's OK for one page, but my document contain three pages.
I try SaveAs complete documents and result was one unclear html file:
Application.ActiveDocument.SaveAs ("e:\ProcessView\processView.html")

How to get complete clear export like with SaveAs option?
 
S

SteveM

How's about referencing the Visio SaveAsWeb Type library?

David has it right. Do a Visio VBA Help using SaveAsWebObject as the
search term. It will lead to code that you can cut and paste
directly.

As David notes, you have to add the Microsoft Visio 12.0 Save As Web
Type Library reference. Note too that the path statement in the code
requires the full path name PLUS the name of the html file.

E.g., c:\outputpath\VisioModel.html

Then it's just plug and play.

SteveM
 
I

Igor G.

Thanks, it's OK!
How to automaticaly send parametar Save (through existing file) when popup
is opened?
 
J

John Goldsmith_Visio_MVP

Hello Igor,

The DoCmd code will invoke the UI command and will automatically display the
dialog. If you want to provide default values and suppress the dialog
you'll need to use the SaveAsWeb library as David and SteveM suggest or use
the command line option
(http://msdn.microsoft.com/en-us/library/aa463347.aspx)

I thought I'd write up a quick blog post on this and I'll post back here
when it's up, but in the meantime you can tryout this code which is adapted
from the Help files:

Public Sub MyProcedure()
Call SaveAsWeb(ThisDocument,
"c:\users\[USERNAME]\MySaveAsWebStuff.htm")
End Sub

Public Sub SaveAsWeb(ByVal targetVisDoc As Document, tgtPath As String)
Dim vsoSaveAsWeb As VisSaveAsWeb
Dim vsoWebSettings As VisWebPageSettings

' Get a VisSaveAsWeb object that
' represents a new Web page project.
Set vsoSaveAsWeb = Visio.Application.SaveAsWebObject

' Get a VisWebPageSettings object.
Set vsoWebSettings = vsoSaveAsWeb.WebPageSettings

' Configure preferences.
With vsoWebSettings
'.StartPage = 1 'Defaults to first page
'.EndPage = 2 'Defaults to last page
.QuietMode = True ' Hides user controlled dialogs
.OpenBrowser = False
.SilentMode = True 'Setting to TRUE will override the above two
properties
.TargetPath = tgtPath ' Output path in the following format:
"c:\your_folder_name\your_filename.htm"
.StoreInFolder = True 'adds support files to "your_filename_files"
folder
End With

' Generate Save As Web output
vsoSaveAsWeb.AttachToVisioDoc targetVisDocument 'Set the Visio document
to save (defaults to active if not set)
vsoSaveAsWeb.CreatePages ' Generate output

End Sub

Best regards

John



John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 
I

Igor G.

Thanks!

John Goldsmith_Visio_MVP said:
Hello Igor,

The DoCmd code will invoke the UI command and will automatically display the
dialog. If you want to provide default values and suppress the dialog
you'll need to use the SaveAsWeb library as David and SteveM suggest or use
the command line option
(http://msdn.microsoft.com/en-us/library/aa463347.aspx)

I thought I'd write up a quick blog post on this and I'll post back here
when it's up, but in the meantime you can tryout this code which is adapted
from the Help files:

Public Sub MyProcedure()
Call SaveAsWeb(ThisDocument,
"c:\users\[USERNAME]\MySaveAsWebStuff.htm")
End Sub

Public Sub SaveAsWeb(ByVal targetVisDoc As Document, tgtPath As String)
Dim vsoSaveAsWeb As VisSaveAsWeb
Dim vsoWebSettings As VisWebPageSettings

' Get a VisSaveAsWeb object that
' represents a new Web page project.
Set vsoSaveAsWeb = Visio.Application.SaveAsWebObject

' Get a VisWebPageSettings object.
Set vsoWebSettings = vsoSaveAsWeb.WebPageSettings

' Configure preferences.
With vsoWebSettings
'.StartPage = 1 'Defaults to first page
'.EndPage = 2 'Defaults to last page
.QuietMode = True ' Hides user controlled dialogs
.OpenBrowser = False
.SilentMode = True 'Setting to TRUE will override the above two
properties
.TargetPath = tgtPath ' Output path in the following format:
"c:\your_folder_name\your_filename.htm"
.StoreInFolder = True 'adds support files to "your_filename_files"
folder
End With

' Generate Save As Web output
vsoSaveAsWeb.AttachToVisioDoc targetVisDocument 'Set the Visio document
to save (defaults to active if not set)
vsoSaveAsWeb.CreatePages ' Generate output

End Sub

Best regards

John



John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk

Igor G. said:
Thanks, it's OK!
How to automaticaly send parametar Save (through existing file) when popup
is opened?
.
 
J

John Goldsmith_Visio_MVP

Hello Igor,

As promised, and for anyone else who's interested, here's the blog post:

http://visualsignals.typepad.co.uk/vislog/2010/03/automating-visios-save-as-web-output.html

Best regards

John



John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk

Igor G. said:
Thanks!

John Goldsmith_Visio_MVP said:
Hello Igor,

The DoCmd code will invoke the UI command and will automatically display
the
dialog. If you want to provide default values and suppress the dialog
you'll need to use the SaveAsWeb library as David and SteveM suggest or
use
the command line option
(http://msdn.microsoft.com/en-us/library/aa463347.aspx)

I thought I'd write up a quick blog post on this and I'll post back here
when it's up, but in the meantime you can tryout this code which is
adapted
from the Help files:

Public Sub MyProcedure()
Call SaveAsWeb(ThisDocument,
"c:\users\[USERNAME]\MySaveAsWebStuff.htm")
End Sub

Public Sub SaveAsWeb(ByVal targetVisDoc As Document, tgtPath As String)
Dim vsoSaveAsWeb As VisSaveAsWeb
Dim vsoWebSettings As VisWebPageSettings

' Get a VisSaveAsWeb object that
' represents a new Web page project.
Set vsoSaveAsWeb = Visio.Application.SaveAsWebObject

' Get a VisWebPageSettings object.
Set vsoWebSettings = vsoSaveAsWeb.WebPageSettings

' Configure preferences.
With vsoWebSettings
'.StartPage = 1 'Defaults to first page
'.EndPage = 2 'Defaults to last page
.QuietMode = True ' Hides user controlled dialogs
.OpenBrowser = False
.SilentMode = True 'Setting to TRUE will override the above two
properties
.TargetPath = tgtPath ' Output path in the following format:
"c:\your_folder_name\your_filename.htm"
.StoreInFolder = True 'adds support files to
"your_filename_files"
folder
End With

' Generate Save As Web output
vsoSaveAsWeb.AttachToVisioDoc targetVisDocument 'Set the Visio
document
to save (defaults to active if not set)
vsoSaveAsWeb.CreatePages ' Generate output

End Sub

Best regards

John



John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk

Igor G. said:
Thanks, it's OK!
How to automaticaly send parametar Save (through existing file) when
popup
is opened?


:

Or, if you like this.

Application.DoCmd visCmdFileSaveAsWebPage

--
Best Regards.

JuneTheSecond
Now, visual calculation is more visual.
http://www.geocities.jp/visualcalculation/english/index.html
.
 

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