?
Solved

VBA AppActivate("[AppWindowTitle]")

Posted on 2014-12-17
6
Medium Priority
?
607 Views
Last Modified: 2014-12-19
AppActivate ("QuickTest Professional - [C:\QTP\TestingScenarios\ThirdParty\TP01 - Customer Change - New Catalog Code]")


Why would this all of a sudden stop working in VBA?  It has been working for some time and now today it is not.  Not even sure what may have changed to cause this.  The file is there.  Another weird happening is that in QTP all references to the File.open....  it did not like either.  I had to re-record/reset the file.open's and those started working.  Also there were other QTP references that I had to reset too, when I did a file import/export functions in QTP.  Any ideas?  Please advise and thanks.
0
Comment
Question by:RWayneH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 24

Assisted Solution

by:Bitsqueezer
Bitsqueezer earned 600 total points
ID: 40506440
Hi,

normally this happens if a reference is broken in the reference list. See VBA editor, Tools, References. If the checked references contains a "MISSED:" then this is a broken reference which you need to repair.

In such cases sometimes normal VBA functions like Date or Left etc. suddenly doesn't work anymore.

That happens mostly if a new version of a library was installed on your computer which you used in your references and Office couldn't automatically update the reference automatically. Try to uncheck the broken reference and search the entry in the list or, if it is not in the list, browse for the library file on your own (see in the old reference by clicking on it before you uncheck it to see where Office tried to search for the file, normally the new one is on the same location).

In case of Windows 64 bit sometimes a library which was in System32 is now in SysWoW64.

Cheers,

Christian
0
 
LVL 18

Assisted Solution

by:Simon
Simon earned 600 total points
ID: 40506472
You might want to try it with the TaskID return value of shell instead:
http://msdn.microsoft.com/en-us/library/office/gg278643%28v=office.14%29.aspx
AppActivate can also use the return value of the Shell function.
MyAppID = Shell("C:\WORD\WINWORD.EXE", 1) ' Run Microsoft Word.
AppActivate MyAppID ' Activate Microsoft
 ' Word.
0
 
LVL 46

Accepted Solution

by:
aikimark earned 800 total points
ID: 40506702
AppActivate will work with just the leading characters.  Unless you have multiple QTP windows open, you don't need to include the file name in the string.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:RWayneH
ID: 40509437
So I replaced it with:
Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "QuickTest Professional - [C:\QTP\TestingScenarios\ThirdParty\TP01 - Customer Change - New Catalog Code]"

If this will work with the leading chars?  Would the rewrite be?
Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "QuickTest Professional"

testing now.
0
 
LVL 46

Expert Comment

by:aikimark
ID: 40509468
yes. leading characters.  in VBA, you should be able to use VB's Appactivate statement.
0
 

Author Closing Comment

by:RWayneH
ID: 40509909
Worked!  Thanks for the help. -R-
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question