I have a macro that I'm trying to use VBA to run a PeopleSoft query. I have another macro that does the same thing (different query) and works great. This one will sometimes open PeopleSoft and sometimes doesn't. I've checked the references and they are same. I know all of the variables are correct because when the macro opens PeopleSoft, it fills in all of the variables correctly. It doesn't execute the query like the other macro does. One difference is that the other macro doesn't display the actual query screen like this one; it just runs the query. When it does open PeopleSoft, I can click on the "run" button and the query executes. I'm wondering if there is some setting that needs to be changed. Or if the code behind the PeopleSoft query executes differently for these 2queries. They are both public queries and I'm running them on a Windows 7, 32 bit machine, and Office 2010. Thanks for the help...........

Below is the code I'm using:

Sub RunQuery()
ThisApp = ""
ThisApp = Application.name
ThisApp = Application.Caption

Application.ScreenUpdating = False

vHypLnk = vHypRoot
vHypLnk = vHypLnk & "&BIND1=" & vGLBU
vHypLnk = vHypLnk & "&BIND2=" & vFY
vHypLnk = vHypLnk & "&BIND3=" & vPERIOD
vHypLnk = vHypLnk & "&BIND4=" & vFROMACCT
vHypLnk = vHypLnk & "&BIND5=" & vTOACCT

With Worksheets("AA0155D")
.Hyperlinks.Add .Cells(30, 1), vHypLnk
.Hyperlinks(1).Follow NewWindow:=True, AddHistory:=True
End With

Workbooks(ThisBook).Worksheets("AA0155D").Cells(30, 1).ClearContents

End Sub