Options

How Activate Excel Window after Open

KeeperRUKeeperRU Member Posts: 58
After "XlsBuf.OpenBook" Excel Window stay minimized.
How can I activate Excel Window and bring it to my screen?

I try somwthing like:

IF XlApp.WindowState = WindowState[1] THEN //minimized
XlApp.WindowState(WindowState[2]); //normal
XlApp.WindowState(WindowState[3]); //maximized
XlApp.ShowWindowsInTaskbar(TRUE);
XlApp.Visible(TRUE);
XlApp.ActiveWindow.Activate;

But it didn't work.

Comments

  • Options
    kinekine Member Posts: 12,562
    Hint: GiveUserControl...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    KeeperRUKeeperRU Member Posts: 58
    kine wrote:
    Hint: GiveUserControl...

    There is a problem. This method has:
    CLEAR(XlApp);
    

    But I need XlApp to run macros in Excel. Macros have interaction with user and should return something to NAV.
    Result := XlApp.Run(MacrosText);
    
  • Options
    kinekine Member Posts: 12,562
    Than copy the function and skip it or add some flag to skip it...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    KeeperRUKeeperRU Member Posts: 58
    kine wrote:
    Than copy the function and skip it or add some flag to skip it...

    That won't work. Because after:
    GiveUserControl();
    
    NAV proceed with the code:
    XlApp.RUN('<macros name>');
    

    That command work only, If after NO NAV CODE.

    And because NAV execute this code aftter GiveUserControl - focus bring back to NAV.
    I think: there is should be some code in VBA macros that Activate this Excel file and bring it to screen.
    But nothing work. :-k
  • Options
    KeeperRUKeeperRU Member Posts: 58
    I found solution, use Always On Top.
    http://www.mrexcel.com/forum/excel-ques ... s-top.html
Sign In or Register to comment.