Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use activex to find window and click OK

Status
Not open for further replies.

kalle82

Technical User
Apr 2, 2009
163
SE
I have a problem regarding VBA for word.

My code returns a form with with several different buttons. I want to click the okay button.

The code im running is modal. Which in this case mean if I dont deal with the form it generates it wont go any further.

The application is being controlled via OLE. I have been through the reference library(jetform filler 5.1 type library) and havent´found any solution to this.

After sum digging I lear that one way to solve this is to start an activex (in another process) that can be started from within the code and it´s only jobb is to look for the generated form and then send command "enter=OK"

Iva managed to creat an OLE automated script, but Active X hmmm... Feels like im digging my own grave.....

Code:
Set JetApp = New filler.Application
Dim jetapp2 As filler.Form


JetApp.Visible = True

filnamn = "O:\FBF\Förfrågan Skatten.JTP"

'Launch Filler and set the objects

'JetApp.Visible = True
Set oForm = JetApp.Forms.Add(filnamn)
'filler.Forms.Open (filnamn)
Set oSubform = oForm.Records(1).Subforms(1)
'Put values into the fields


oSubform.Fields("DIARIENUMMER").Text = TextBox4 ' this is where you would put the variable or field data string
oSubform.Fields("NAMN").Text = namnet$ + mellannamn$ + efternamn$
oSubform.Fields("PNR").Text = personnummer$
oSubform.Fields("ADRESS").Text = streckadress$ + sarskildadress$

filler.ExecuteCommand (jfDownloadFormView)

'Print and shut down

'oForm.PrintForm(1, 19, 1, 1, 1, 1, , , True) = True

'filler.ActiveForm.DetachEventNotify (1)

'JetApp.Quit

Set JetApp = Nothing
Set oForm = Nothing
Set oSubform = Nothing
Set kommando = Nothing
 
There is also another way I "think". There is a command i could use.

it´s reached by having this

codefiller.application.activeform.printform()

, thing is that Im not to familiar with Printform. The help is offers is

Printform([Starrec],[Endrec],[startpage],[endpage],[copies],[output],[pagenumbering],[macrouse],[macronumber],[spool]

I want it to use the (Informatik Image Driver 3.0A) to print a tif that i use to fax later. Maybe that has to be handled through a printer macro...

If you have any codeexamples of jetform ole or anything just a link would be helpful...

cheers Carl!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top