Results 1 to 9 of 9

Thread: Word Document to HTML

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    13

    Word Document to HTML

    Hi, I'm new to VB so go easy on me. I need to write some code that opens a Word Document and then either extracts the data so that a HTML document can be created or simply resaves it as an HTML document.

    I've had a quick look around the net and tried adding an Object Reference to Microsoft Word Object X.0 Library to my Project. So that I could play around with things, but immediately It was telling me the following weren't defined.

    Dim objWdApp As Word.Application
    Dim objWdDoc As Word.Document
    Dim objwdRange As Word.Range

    Could anyone either explain what kind of thing I would need to do or link me to some useful tutorial.

    Muchos Gracias
    Last edited by alanio; Jan 8th, 2009 at 11:12 AM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Word Document to HTML

    Try
    vb.net Code:
    1. Dim objWdApp As Word.Application = DirectCast(CreateObject("Word.Application"), Word.Application)
    2. Dim objWdDoc As Word.Document = DirectCast(objwdApp.Documents, Word.Document)

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    13

    Re: Word Document to HTML

    nope, same error. It's like it doesn't recognise them, or the reference didn't work

    Type word.Application is not defined
    Type word.Range is not defined
    Type word.Document is not defined

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Word Document to HTML

    It sounds like you do not have a reference set.

    You did Project/Add Reference, clicked on the .COM tab, found Microsoft Word Library, selected it, and clicked OK, right?

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    13

    Re: Word Document to HTML

    Yup. Before I do anything else, is this what I should be using to acheive what I want ? Ie Word to HTML

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    13

    Re: Word Document to HTML

    Thanks that link looks useful

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Word Document to HTML

    It should. I wrote it just for you but its a good topic for a FAQ so I posted it there.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    New Member
    Join Date
    Dec 2008
    Posts
    13

    Re: Word Document to HTML

    Well, thankyou I do feel honoured.

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