Export visio to Ms word and PDF using VB.NET

J

JuneTheSecond

My idea is to select a shape and copy, and pasteSpecial on the Word.
Please check if Word and pdf have method like PasteSpecial of Visio.
 
A

Al Edlund

In v2007 (since you neglected to mention your version), exporting to pdf
looks kinda like this

(assumes you have the free add-in installed)

'Private Sub cmdExport_Click()
' Dim visPage As Visio.Page
' Dim strPageName As String
' Dim strPathName As String
' strPathName = "c:\"
'
' If ThisDocument.Pages.Count < 2 Then
' MsgBox "This routine saves page 2 as a pdf file"
' Exit Sub
' End If
'
' Set visPage = ThisDocument.Pages(2)
' visPage.CenterDrawing
' strPageName = visPage.Name
' ActiveWindow.Page = visPage
'
' strPageName = Replace(strPageName, " ", "")
' strPageName = strPathName & strPageName & ".pdf"
'
' ThisDocument.ExportAsFixedFormat visFixedFormatPDF, strPageName,
visDocExIntentPrint, visPrintCurrentPage
'
'End Sub

For moving it to Word I'd just do a copy and paste.

ActiveWindow.SelectAll
ActiveWindow.Group
ActiveWindow.Copy

'add your word specific paste here...

al
 
J

JAWAAHAR

hi Edlund,

i am using vb.net 2.0 . i'd follow ur way but in "ActiveWindow.Page =
visPage" got some err. can u give suggest me a solution for this.

thanks.
 
J

JAWAAHAR

Al Edlund said:
In v2007 (since you neglected to mention your version), exporting to pdf
looks kinda like this

(assumes you have the free add-in installed)

'Private Sub cmdExport_Click()
' Dim visPage As Visio.Page
' Dim strPageName As String
' Dim strPathName As String
' strPathName = "c:\"
'
' If ThisDocument.Pages.Count < 2 Then
' MsgBox "This routine saves page 2 as a pdf file"
' Exit Sub
' End If
'
' Set visPage = ThisDocument.Pages(2)
' visPage.CenterDrawing
' strPageName = visPage.Name
' ActiveWindow.Page = visPage
'
' strPageName = Replace(strPageName, " ", "")
' strPageName = strPathName & strPageName & ".pdf"
'
' ThisDocument.ExportAsFixedFormat visFixedFormatPDF, strPageName,
visDocExIntentPrint, visPrintCurrentPage
'
'End Sub

For moving it to Word I'd just do a copy and paste.

ActiveWindow.SelectAll
ActiveWindow.Group
ActiveWindow.Copy

'add your word specific paste here...

al
 
A

Al Edlund

that code just makes the second page the active one so that it matchs the
export call later on in the routine.
al
 

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