View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default How to bypass "Enter Parameter Value" via macros

There are a number of scripts out there that will answer a question like this
but they are all work arounds with time delays and such. I would say that
your best bet is to write queries for each different database to avoid the
question in the first place.

Here is some code to send the "y" key to Outlook

Dim fso As Object
Dim fsoFile As Variant
Dim wshShell As Variant

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem


On Error GoTo ErrorHandler
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Set fso = CreateObject("Scripting.filesystemobject")
Set fsoFile = fso.createtextfile("Bypass.vbs")

fsoFile.writeline "Set fso = Createobject(""Wscript.shell"")"
fsoFile.writeline "While fso.appactivate(""Microsoft outlook"") = false"
fsoFile.writeline "wscript.sleep 1000"
fsoFile.writeline "Wend"
fsoFile.writeline "fso.sendkeys ""a"", true"
fsoFile.writeline "fso.sendkeys ""y"", true"
fsoFile.writeline "wscript.sleep 7000"
fsoFile.writeline "while fso.appactivate (""microsoft outlook"") = false"
fsoFile.writeline "wscript.sleep 1000"
fsoFile.writeline "wend"
fsoFile.writeline "fso.sendkeys ""y"", true"
fsoFile.Close

..
..
..

Set wshShell = CreateObject("Wscript.Shell")
wshShell.Run ("bypass.vbs")

"Jeff" wrote:

I have a simple macro to Generate a Report that I will use for several
databases; however, I have certain datafields that are present in some
databases and not others -- which is okay. My issue is when executing
the report macro on a database that does not have these datafields, I
get a separate popup window ("Enter Parameter Value"). If I don't enter
anything and manually click "Okay", the macro will complete the
remaining steps and generate the report.

Question - What can I do to have the Macro click "Okay" and complete
the remaining steps. My goal is to bypass the manual click of "Okay".