Results 1 to 2 of 2

Thread: Automating Word - SaveAs(HTML) How interfaces work?

  1. #1

    Thread Starter
    Lively Member hbandarra's Avatar
    Join Date
    Aug 2002
    Location
    Lisbon, PT
    Posts
    66

    Angry Automating Word - SaveAs(HTML) How interfaces work?

    The above code found in:
    http://msdn.microsoft.com/library/de...7/html/w2h.asp
    that saves any word document in html format doesn't work with vb .net.

    It says at compile time:
    "'FileConverters' is a type in 'Word' and cannot be used as an expression"

    I've search for the definition of "FileConverters" and found out it is an Interface. Well... I don't now much about it and how to solve this problem!

    Thanks!
    ------------------------------------------------------------------------------

    Sub HTMLSave()
    ' This procedure steps through the FileConverters collection
    ' looking for the HTML converter, and then converts the current file.

    Dim wrdConverter As Word.FileConverter
    Dim strMessage As String
    Dim strPath As String

    'Get a name and location for the converted file.
    strMessage = "Enter a path and file name for the converted file."
    strPath = InputBox(strMessage)

    For Each wrdConverter In Word.FileConverters '<-- HERE!!!
    'If found, Save As, then exit the loop.
    If wrdConverter.ClassName = "HTML" Then
    ActiveDocument.SaveAs _
    FileName:=strPath, _
    FileFormat:=wrdConverter.SaveFormat
    Exit For
    End If
    Next wrdConverter
    End Sub

  2. #2

    Thread Starter
    Lively Member hbandarra's Avatar
    Join Date
    Aug 2002
    Location
    Lisbon, PT
    Posts
    66
    doc.SaveAs("filename", Word.WdSaveFormat.wdFormatHTML)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width