|
-
Jan 29th, 2010, 07:24 AM
#1
Excel issue in Local web server
Hi all,
I am using this code to get th ProcessID of newly Created Excel.
Code:
Imports Microsoft.VisualBasic
Imports Microsoft.Office.Interop
Public Class Class1
<Runtime.InteropServices.DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetWindowThreadProcessId(ByVal hwnd As Integer, _
ByRef lpdwProcessId As Integer) As Integer
End Function
Private processId As Integer
Sub New()
Dim oExcel As Excel.Application
oExcel = CreateObject("Excel.Application")
GetWindowThreadProcessId(oExcel.Hwnd, processId)
oExcel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel)
oExcel = Nothing
End Sub
End Class
This code returns the Process ID Correctly with Virtual Server
Now I deployed it using a Website, and the ProcessID is 0
Has anyone experienced with this ?
Last edited by danasegarane; Jan 29th, 2010 at 07:32 AM.
Please mark you thread resolved using the Thread Tools as shown
-
Jan 29th, 2010, 08:20 AM
#2
Re: Excel issue in Local web server
Hey,
Ok, I have to ask, why are you creating an instance of Excel, to simply close it again?
Gary
-
Jan 29th, 2010, 12:36 PM
#3
Hyperactive Member
Re: Excel issue in Local web server
Did you put a breakpoint to discover which line is the first culprit.
-
Jan 29th, 2010, 08:33 PM
#4
Re: Excel issue in Local web server
 Originally Posted by gep13
Hey,
Ok, I have to ask, why are you creating an instance of Excel, to simply close it again?
Gary
Hi Gary. Its only a sample. I am trying to automate excel.
Thanks Dana
Please mark you thread resolved using the Thread Tools as shown
-
Jan 30th, 2010, 04:58 AM
#5
Re: Excel issue in Local web server
Hey,
Ah, ok, that makes a bit more sense then 
I take it Excel is installed on the server that you are running the site on, correct?
Gary
-
Feb 1st, 2010, 03:41 AM
#6
Re: Excel issue in Local web server
Your web server will likely clamp down on what your web application is allowed to do. If you want to automate Excel, use the Primery Interop Assemblies for Office and work with the Excel object there by referencing the class libraries directly.
But this also depends on what you're trying to do. If all you want to do is produce an XLS as part of a report, you could just as well use an HtmlTextWriter.
-
Feb 1st, 2010, 03:55 AM
#7
Re: Excel issue in Local web server
Hi Mendhak,
I was thinking of that, But my report contains nearly 30 pages which is very tedious to create
Please mark you thread resolved using the Thread Tools as shown
-
Feb 4th, 2010, 10:18 AM
#8
Re: Excel issue in Local web server
Alright, but this is on the web server. Even if you automate Excel, you'll have to create some sort of an interface anyways.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|