Import Text File into Excel with fixed width -
i'm new vba , i've been asked fix code don't know commas right after open "{filename}". can explain? thanks!
sub fixed_width_test() set objexcel = createobject("excel.application") objexcel.visible = true objexcel.workbooks.opentext _ `enter code here`"c:\users\gcosta1\desktop\bdtf\daily_activation_txn_ca_071113.txt", , , xlfixedwidth, , , , , , , , , array(array(0, 1), array(2, 1), array(27, 1), array(77, 1), array(92, 1), array(108, 1), array(128, 1), array(153, 1), array(178, 1), array(203, 1), array(211, 1), array(217, 1), array(249, 1), array(179, 1), array(287, 1), array(293, 1), array(301, 1), array(317, 1), array(334, 1), array(337, 1), array(353, 1), array(383, 1), array(386, 1), array(392, 1), array(393, 1), array(410, 1), array(421, 1)) end sub
open text method in vba takes arguments below
opentext(filename, origin, startrow, datatype, textqualifier, consecutivedelimiter, tab, semicolon, comma, space, other, otherchar, fieldinfo, textvisuallayout, decimalseparator, thousandsseparator, trailingminusnumbers, local)
in code first argument passed method filename, ,,, represents no argument has been passed origin,startrow , on , forth.
more details / source: http://msdn.microsoft.com/en-us/library/office/aa195814(v=office.11).aspx
Comments
Post a Comment