Info

The VB Editor is now in step mode. The line about to be executed is highlighted in yellow with a yellow arrow in the margin before the code (see Figure 2.18).

Figure 2.18

The first line of the macro is about to run.

IimoEtlHvoice))

KeyboaE-l SboEtcuc! CïeJ

Vbrkfeoolo.OpctiTcxt rilciMM:» _ "C:\invoiceitxc", Origin

SHRMI!*!, 0»t«Typ«! = »*lieil»ltM, 1« ! J J eQUOte _

, comteutiveiellbitee:-False, tob!"Ttue, se»iCQlon!Taise, lciwmï-Truç , LipacejTalae, OtDer¡"False, rieldir.Io;-Arra7(Arra'/(lr 3), Array 12, l], Ac toy 43, î)i Ar coy [4, », AfiairtS, 1), AseftyfCj IK 1H- Te*ilin

SelectIOC. KniilKiUuvD) .Select

("Al1"t-Stleet ActiveCell .ForHUlaElCl * ""Total" A**geC*i4"f-»elect

Selectioo.rotwileJUCl - "■STO<Rl-«lC:R[-l|CJ "

¡¡election, Autorin Destination! -Hanje l'EH;(iH"| , Type:-KiFlllSefauit

Se lectio»,font,fro 10 - T*iae mjv9(nX4:Hn] .Select aeiection.rant,fro id - True

Ce 13a > Select

3e lect ion .Ca lmrni. AucaFit

In this case, the next line to be executed is the Sub ImportInvoice() line. This basically says, "We are about to start running this procedure." Press the F8 key to execute the line in yellow and move to the next line of code. The long code for OpenText is then highlighted. Press F8 to run this line of code. When you see that Selection.End(xlDown).Select is highlighted, you know that Visual Basic has finished running the OpenText command. Indeed, you can use Alt+Tab to switch to Excel and see the Invoice.txt file has been parsed into Excel. Note that A1 is selected (see Figure 2.19).

Figure 2.19

Switching to Excel shows that the Invoice, txt file has indeed been imported.

Figure 2.19

Switching to Excel shows that the Invoice, txt file has indeed been imported.

0 0

Post a comment