Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bring Excel to front
Message
 
 
À
07/08/2013 17:55:35
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01580013
Message ID:
01580014
Vues:
72
>In the past, when I opened Excel through Automation (from Visual FoxPro), it came to the front automatically. I believe that was with an older version of the operating system. Now it doesn't. I suspect this has to do with some security system implemented by newer versions of the operating system itself, in which case not much can be done... but I wanted to check whether this is really the case.
>
>TIA,
>
>Hilmar.

Check this solution http://forum.foxclub.ru/read.php?32,177182,258927#msg-258927
Приложение Excel 
  
 * Создание экземпляра приложения Excel  
  LOCAL loExcel as Excel.Application  
  loExcel = CreateObject("Excel.Application")  
 * Далее идет создание и заполнение документа  
  ...  
 * Сформированный документ делается видимым  
  loExcel.Visible = .T.  
    
 * Выводится экземпляр приложения Excel на передний план  
  LOCAL loShell  
  loShell=CreateObject("WScript.Shell")      
  IF loShell.AppActivate(loExcel.Caption) = .T.    
  	loShell.SendKeys("% ~")    
  ELSE    
  	MessageBox("Приложение "+loExcel.Caption+" не найдено")    
  ENDIF

Однако в отношении Word или Excel есть специфический способ активизации, основанный на том, что разворачивание этого окна на максимум из свернутого (минимизированного) состояния автоматически приводит к его активизации. 

Приложение Word 
  
 * Выводится экземпляр приложения Word на передний план  
  #DEFINE wdWindowStateMinimize 2  
  #DEFINE wdWindowStateMaximize 1  
    
  loWord.WindowState = wdWindowStateMinimize	&& Сворачиваем окно  
  loWord.WindowState = wdWindowStateMaximize	&& Разворачиваем окно, что приводит к его активизации  

Приложение Excel 
  
 * Выводится экземпляр приложения Excel на передний план  
  #DEFINE xlMinimized -4140  
  #DEFINE xlMaximized -4137  
    
  loExcel.WindowState = xlMinimized	&& Сворачиваем окно  
  loExcel.WindowState = xlMaximized	&& Разворачиваем окно, что приводит к его активизации  
I've translated this before, don't have time right now.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform