CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Location
    Singapore
    Posts
    172

    Openning a Word Document

    Hi All,

    The following is opening a particular xls file
    Sub chartsheet_onclick()
    call OpenWorkbook("d:/My Documents/XYZ.xls")
    End Sub

    Sub OpenWorkbook(strLocation)

    Set objExcel = CreateObject("Excel.Application")

    objExcel.Visible = true
    objExcel.Workbooks.Open strLocation
    objExcel.UserControl = true
    objExcel.Sheets("sheet1").Visible = True
    End Sub

    So how do U open a word document e.g. XYZ.doc ?
    --------------------------------------------
    Stephen WKH
    --------------------------------------------
    Love yourself is the beginning of Loving the World

  2. #2
    Join Date
    Jul 2002
    Location
    India
    Posts
    505
    Quite similar to opening Excel

    Sub OpenDoc(strLocation)

    set d = CreateObject("Word.Application")
    d.Visible = true
    d.Documents.Open strLocation

    End Sub


    Satish

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