Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to minimize Excel while my application is running?

Tags:

excel

vb.net

How can I minimize Excel and new opened excel while my application is running?

I have written the following code, but the code fails.

If you wonder why I want to minimize Excel that is because my application fails if user clicks any excel cell!

Imports System.Management
Imports Microsoft.Office.Interop
Imports System.Runtime.InteropServices
Public Class Form1
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
    Timer1.Enabled = True
    Timer1.Interval = 100
    Timer1.Start()
End Sub
End Class
like image 994
Herry Markowitz Avatar asked Oct 31 '22 14:10

Herry Markowitz


2 Answers

I done a similar thing to my Word application to hide it when I'm using Word object for spell checking. I'm very positive you can do that to excel also;

Excel._Application excel = new Excel.Application();
excel.Visible = false;
excel.ShowWindowsInTaskbar = false;

NOTE: The code is in C#.Net

like image 123
Irshad Avatar answered Nov 15 '22 07:11

Irshad


setting Visible to False is wrong, it's not minimized. Need to set Visible to true AND minimized

        oXL.Visible = True
        oXL.WindowState = Excel.XlWindowState.xlMinimized
like image 24
BachPhi Avatar answered Nov 15 '22 07:11

BachPhi