CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Posts
    47

    Problem when using Option Explicit ON

    Hi

    I want to open a word document using vb net. All works find when i'm not usins Option Explicit on and
    Option Strict On.

    here's my code

    Dim objwrd As Object

    objwrd = CreateObject("Word.application")
    objwrd.application.Visible = True
    objwrd.Documents.open("E:\VbNet\test.doc")

    The last two lines are in error if these two option are ON . Why? Is anyboby can help me with this?

    Thank you
    Alexandre

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868
    Option Strict means you HAVE to define every variable as a specific date type (or object) so this should work

    Dim objWord as Word.Application 'Specific Object Type

    INSTEAD of

    Dim objWord as Object ' Generic Object

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

Featured