473,385 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why does Excel not want to open within a panel?

It takes a lot for me to give up on finding the solution and for this I've finally reached that point. I have a program that opens a few other programs (PowerPoint, Excel and mIRC) and runs each one inside a panel on the form. I'm having no issues with PowerPoint or mIRC. Excel was working for a bit and now just doesn't work. Here is my code:

Expand|Select|Wrap|Line Numbers
  1. Private Const WM_SYSCOMMAND As Integer = 274
  2. Private Const SC_MAXIMIZED As Integer = 61488
  3. Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild as IntPtr, ByVal hWndNewParent As IntPtr) As Integer
  4. Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal IParam As Integer) As Integer
  5. Dim proc3 As System.Diagnostics.Process
  6.  
  7. Private Sub LoadTracker()
  8.  
  9.   proc3 = System.Diagnostics.Process.Start(NameOfMyExcelFile)
  10.   proc3.WaitForInputIdle()
  11.   SetParent(proc3.MainWindowHandle, Me.TPanel.Handle)
  12.   SendMessage(proc3.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
  13.  
  14. End Sub
  15.  
I have a button on the form which launches LoadTracker.
Oct 29 '10 #1
1 2497
Yes, I do realize I wrote SC_MAXIMIZED in the Private Const line and then have it as SC_MAXIMIZE below that. It was right in the actual code.

Anyway I figured it out. I had the SetParent line and the SendMessage line swapped. I put them back in the right order and it worked again.
Oct 29 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Lisa | last post by:
I have an excel file on my server, which contains an embedded query. I want to be able to open the excel file, pass the contents of my variable into a cell within the worksheet and then refresh the...
1
by: ST | last post by:
Hi, I'm having problems opening up excel thru my code. It will write and saveas an excel file, but the application won't open on the user's computer, excel seems to be hidden, because it shows up...
1
by: mr_ocp | last post by:
Hi friends I need routines to create an excel file with worksheets for each customer and a text file as well for each customer, first worksheet would be a "Summary Report", here is the code that...
0
by: (Pete Cresswell) | last post by:
I'm writing a loop that Dir$'s through about a hundred MS Excel spreadsheets and extracts info from maybe 5-20 workbooks within each into a staging table. Problem is that I don't think I have any...
0
by: Garth | last post by:
Hi, I'm opening and closing an excel using C#. Once the file has been opened and closed I then double click on the file with Windows Explorer and excel opens and then just hangs. Can anyone help?...
3
by: Ken Hall | last post by:
Is it possible to create an Excel spreadsheet using VB.NET without opening the Excel application or having to have the Excel application on the operating computer? KH
16
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub...
1
by: mohitpande | last post by:
i am using windows 2003 server and iis 5.1 for hosting my web application and windows xp as client OS i ahv excel reports in my web application which are not opening in client machine i hav...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: shyshack | last post by:
Hi, I am quite new in C#. I am writing an application in which I have to open Excel file to import data from it. When opening small files everything works ok - the problem appears when I try to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.