Importing + formatting XML files into Excel -


good day

i need following vba code, want excel following:

  • open multiple xml files
  • format files reflect columns
  • paste info in columns in 1 sheet underneath each othet

the code needs remove header line in line 1 when combining in 1 sheet.

this have far

sub combined()  'updatebykutoolsforexcel20151214     dim xwb workbook     dim xswb workbook     dim xstrpath string     dim xfiledialog filedialog     dim xfile string     dim xcount long  'added dim lastrow long 'new line  on error goto errhandler set xfiledialog = application.filedialog(msofiledialogfolderpicker) xfiledialog.allowmultiselect = false xfiledialog.title = "select folder [kutools excel]"  if xfiledialog.show = -1     xstrpath = xfiledialog.selecteditems(1) end if  if xstrpath = "" exit sub  application.screenupdating = false  'probleem le die "usedrange" 'hy moet net begin copy n sekere plek, en tot n sekere plek set xswb = thisworkbook xcount = 1 'lyntjie waar hy moet paste  xfile = dir(xstrpath & "\*.xml") 'alle file met .xml in folder while xfile <> ""     set xwb = workbooks.openxml(xstrpath & "\" & xfile, loadoption:=xlxmlloadimporttolist)      'copy van xwb.sheet na ons xswb.sheet     lastrow = xwb.sheets(1).range("a1048576").end(xlup).row 'new line     'msgbox lastrow      if xcount = 1 'just copy headers if 1st file (new lines)      xwb.sheets(1).range("a1:bq1").copy xswb.sheets(1).cells(xcount, 1)      xcount = 2     end if       'xwb.sheets(1).usedrange.copy xswb.sheets(1).cells(xcount, 1) 'copy in cell 2,1 probleem hier     xwb.sheets(1).range("a2:bq" & lastrow & "").copy xswb.sheets(1).cells(xcount, 1)      xwb.close false      lastrow = xswb.sheets(1).range("a1048576").end(xlup).row 'new line - kry laaste ryjite van ons huidige werkboek     xcount = lastrow + 1 'new line     'xcount = xswb.sheets(1).usedrange.rows.count + 2 'update waar hy nou na moet copy     xfile = dir() loop  application.screenupdating = true  xswb.save exit sub errhandler:     msgbox "no files xml", , "kutools excel"  end sub 

any appreciated


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -