DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Linking excel & word documents

  1. #1
    Join Date
    Apr 2010

    Linking excel & word documents

    Hi - I need help!!

    I want to use a form with buttons on to link to open excel files or word documents. Therefore the files need to be available to the program which must run from a CD. (need the CD to be in always).

    I have added the files to resources and see them in the solution explorer bin folder. I have also made them "copy always" in the file properties. See path of attendance register in sloution explorer.
    Test1/bin/Debug/resourses/Attendance register. doc.

    I need the code for the buttons. I know it needs to be relative path but thats as far as me knowing goes.

    I am using visual studio 2005 (programming in VB) , windows7, office 2007 but save files as 2003.

    Urgently need help so that I can move on, battling for 3 weeks no luck!!!

  2. #2
    Join Date
    Nov 2003
    Portland, OR
    Try this:

    Dim FileName As String = "Resources\Attendance Register.doc"
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Apr 2010

    Linking need help

    I tried it but as soon as it is installed on another pc it does not see the link to the document.

    I get error message " Unhandled exception error" The system cannot find the file specified.

  4. #4
    Join Date
    Nov 2003
    Portland, OR
    Is the document in a "Resources" folder under the folder where your .EXE is installed?
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Apr 2010

    Linking files

    I have attached a snip from solution explorer, is it?? see attached file

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            'If Me.OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            'Dim fileName As Object = OpenFileDialog1.FileName
            Dim fileName As Object = "C:\Users\admin\Documents\Visual Studio 2005\Projects\Test1\Test1\bin\Debug\Resources\Attendance Register.doc"
            'Dim readOnly as Object = False
            Dim isVisible As Object = True
            Dim missing As Object = System.Reflection.Missing.Value
            WordApp.Visible = True
            Dim aDoc As Microsoft.Office.Interop.Word.Document
            aDoc = WordApp.Documents.Open(fileName, , False, False, , , True)
            'End If
        End Sub

    Thats what I've been trying - I know its wrong but at least you can see what I've done

    Thanks for your input so far
    Attached Images Attached Images
    Last edited by SG01; 04-15-2010 at 02:03 AM.

  6. #6
    Join Date
    Feb 2004
    Longueuil, Québec
    The path you gave "C:\Users\admin\Documents\Visual Studio 2005\Projects\Test1\Test1\bin\Debug" is the development path. I would be very surprised if the path was the same on the other machine.

    And even the application is installed in My Documents ("C:\Users\admin\Documents") on the test machine, this path can change name between different versions of Windows.

    Try with Path.Combine(Application.StartupPath , "Resources\Attendance Register.doc"), which is a reference to where the application is installed.
    Jacques Bourgeois

Similar Threads

  1. search excel from word and import results
    By excelusa in forum VB Classic
    Replies: 0
    Last Post: 05-02-2009, 02:41 AM
  2. Excel & Word - Access Denied
    By krishna170978 in forum .NET
    Replies: 0
    Last Post: 01-04-2006, 12:55 PM
  3. Replies: 0
    Last Post: 05-15-2003, 06:20 PM
  4. Converting MS Word Documents to html thru ASPs..
    By Chris Schmidt in forum ASP.NET
    Replies: 0
    Last Post: 12-13-2000, 04:59 PM
  5. Manipulating Word Documents
    By Matt Hodge in forum Web
    Replies: 1
    Last Post: 04-12-2000, 03:51 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center