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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace VBscript for 2700 titles

Status
Not open for further replies.

Cosmiccradle

Technical User
Mar 24, 2003
63
NL
I'm a newbie at this and need to change a small mistake in 2700 titles. To do it by hand would take weeks so I thought I'd try it with VBscripting. I understands macros but can't make heads or tails of this, I keep getting an error message on line 2. Line 6 is to start at the first title and then to the next, sorry for the Dutch words in it. Can anyone figure out what I'm doing wrong





1 Sub Log1()
2 CreateObject("Scripting.FileSystemObject")
3 Set Bestand = fso.CreateTextFile("c:\log1.txt", True)
4
5 Application.ActiveWindow.Command "z sel 22-05-2002"
6 Application.ActiveWindow.Command "t 1"
7
8 Aantal = Application.ActiveWindow.Variable("P3GSZ")
9
10 For Teller = 1 To Aantal
11 Application.ActiveWindow.SimulateIBWKey "F7"
12 Application.ActiveWindow.Title.ReplaceAll "c---j-m", "c---j", False
13 Application.ActiveWindow.SimulateIBWKey "FR"
14
15 If Application.ActiveWindow.Status = "ERROR" Then
16 Bestand.Writeline("PPN " & Application.ActiveWindow. _
17 Variable("P3GPP") & “had een foutstatus")
18 Application.ActiveWindow.SimulateIBWKey "FE"
19 Else
20 Bestand.Writeline("PPN " & Application.ActiveWindow. _
21 Variable("P3GPP") & “had geen foutstatus")
22 End If
23 Application.ActiveWindow.SimulateIBWKey "F1"
24 Next
25
26 Bestand.Close
27 End Sub
 
Replace this:
CreateObject("Scripting.FileSystemObject")
By this:
Set fso = CreateObject("Scripting.FileSystemObject")

BTW which Application you want to automate ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top