Results 1 to 4 of 4

Thread: [RESOLVED] [2008] Include xls File in Project

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    294

    Resolved [RESOLVED] [2008] Include xls File in Project

    Is it possible to include an excel file in your project, and make reference to it in your code without having the actual file on the computer that the program is running on?

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

    Re: [2008] Include xls File in Project

    You could reference it the same way you would reference any embedded resource. But are you needing to save changes or ??? with it?
    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

  3. #3
    Lively Member cageybee's Avatar
    Join Date
    Nov 2005
    Location
    Stanardsville, VA
    Posts
    81

    Re: [2008] Include xls File in Project

    I use an excel file in one of my programs....but I launch Excel to interact with it. Here are some sample lines of code I used:

    Schedule = CreateObject("Excel.Application")
    Schedule.Workbooks.Open(schedfilpath)
    ...........
    row = row + 1
    .Range("A" & Format$(row)).Select()
    Acell = (.ActiveCell.FormulaR1C1)
    ...........
    Schedule.workbooks.close()
    KillExcel()
    Schedule = Nothing
    Schedule.release()


    requires: Interop.Excel.dll
    as a reference. Hope this helps.

    oh ya:
    Private Sub KillExcel()
    Dim myProcesses() As Process
    Dim myProcess As Process

    On Error Resume Next
    myProcesses = Process.GetProcessesByName("EXCEL")
    For Each myProcess In myProcesses
    myProcess.Kill()
    Next
    On Error GoTo 0
    myProcesses = Nothing
    myProcess = Nothing

    end sub
    Last edited by cageybee; Jul 8th, 2008 at 03:47 PM.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    294

    Re: [2008] Include xls File in Project

    Quote Originally Posted by cageybee
    I use an excel file in one of my programs....but I launch Excel to interact with it. Here are some sample lines of code I used:
    Well ya I do that too, I'm just wondering if I can do it with an Excel file from within my project.

    Quote Originally Posted by RobDog888
    You could reference it the same way you would reference any embedded resource. But are you needing to save changes or ??? with it?
    How do you make that reference robdog? I'm sorry, this is really the first program I've written in .NET. I am needing to save changes..I take it you can't do that if you use it as a resource? What is "??? with it?" lol

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