-
Jan 16th, 2021, 07:37 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Windows 10 - Excel
I have just run a programme under widows 10 (previously ran under windows 7) which opens an excel file and reads the data, then closes the excel file. When this ran under windows 7, it did this in the background and did not display the excel file on screen.
Now that this is converted to windows 10, when it reads the excel file, it display excel on the screen just like it had been opened from the command prompt. Is there a reason for this ?
The code that opens the file is below and has the excel Visible se to False ?
Code:
Try
xlApp = CreateObject("Excel.Application")
Catch ex As Exception
MsgBox("Error Defining Excel Object")
Exit Function
End Try
Try
xlApp.Workbooks.Open(fileAndPathName)
xlApp.Visible = False
xlApp.WindowState = vbMaximizedFocus
xlApp.UserControl = True
Catch ex As Exception
MessageBox.Show("Error 1 Opening File" & Environment.NewLine & ex.Message)
Exit Function
End Try
-
Jan 16th, 2021, 09:08 AM
#2
Re: Windows 10 - Excel
I'm not sure why the difference between Win7 and Win10 but how does it make sense to specify that the Excel window should be maximised and focused if it's not visible? It may be that some difference in the OSes causes the first statement to take precedence on Win7 and the second to take precedence on Win10.
-
Jan 16th, 2021, 09:33 AM
#3
Thread Starter
Hyperactive Member
Re: Windows 10 - Excel
Thanks, I should have said that office/ excel has also been upgraded from office 2010 to office 2019 as well
However i have removed
.windowstate and .usercontrol
And it works ok again.
-
Jan 16th, 2021, 01:51 PM
#4
Hyperactive Member
Re: Windows 10 - Excel
glad your problem is solved!
btw, please mark this thread as resolved under the thread tools/mark thread resolved option at the top of the page, so we can focus on different problrems...
Please dont forget to add good reputation if my advices were useful for you.
How? Under this post there is "RATE THIS POST" button. Click on it.
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
|