Results 1 to 4 of 4

Thread: [RESOLVED] Windows 10 - Excel

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    314

    Resolved [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

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,339

    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.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    314

    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.

  4. #4
    Addicted Member
    Join Date
    Oct 2018
    Posts
    220

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width