+ Reply to Thread
Results 1 to 4 of 4

"if excel window was on the second screen" code syntax

  1. #1
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    "if excel window was on the second screen" code syntax

    Hi all,
    I have 2 screens in my office. I want to write a code that maximizes Excel when Excel window is positioned on the second screen. I wish this code to be null if Excel window was on the primary screen. I tried a lot but I did not get it to work.
    I have the following code. it maximizes Excel on the second screen. how can I alter it to be within if statement instead?
    I am a beginner. So, any help will be super appreciated

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: "if excel window was on the second screen" code syntax

    hi again!
    i got an idea! is there a way to ask excel whether its application is on dual screens?
    something like
    Please Login or Register  to view this content.
    do you think that could work?! thanks in advance!

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,047

    Re: "if excel window was on the second screen" code syntax

    You can get the number of monitors using the EnumDisplayMonitors API

    In a standard module
    Please Login or Register  to view this content.
    Example usage
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-29-2012
    Location
    Latakia, Syria
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: "if excel window was on the second screen" code syntax

    thanks a lot for your help!
    I just realised that this will prevent me from minimizing excel on the main screen! hahaha
    it seems challenging indeed!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run the code again after 1min, when "We couldn't authenticate...." window pops up
    By TK2013 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2021, 11:39 PM
  2. [SOLVED] syntax error in an "and" in "if" statement in a "for" loop
    By MaartenRo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2020, 08:03 PM
  3. [SOLVED] How to prevent "update values" window open when code executes to enter formula in table?
    By carlito2002wgn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2019, 03:44 PM
  4. Looking for Excel vba code for starting the "screen clipping" tool in excel
    By CetinRamazan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2016, 10:48 AM
  5. [SOLVED] Open Workbook in "Full Screen" mode but with sized "Window" View
    By HGL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2016, 05:54 AM
  6. VBA - IE - click on "Open" in an internet explorer "file download" window
    By victoire in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-22-2013, 07:08 AM
  7. [SOLVED] Excel 2003 VBA - "Maximizing" Window & "Calculating" Workbook
    By JingleRock in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-25-2006, 12:10 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1