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?
Printable View
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?
You could reference it the same way you would reference any embedded resource. But are you needing to save changes or ??? with it?
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
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 cageybee
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?" lolQuote:
Originally Posted by RobDog888