excel - Convert all files from .html to .xlsx in a folder and save as filename using VBA -


my problem header states.

convert files within folder html (downloaded browser) .xlsx format.

  1. i use same folder path store files want converted , supersede on daily basis
  2. the number of files used on daily basis change
  3. there no 'file masks' relevant files ones within folder, there no subfolders
  4. files must opened, converted xlsx , saved again same name of source file.
  5. rinse , repeat until files have been converted , saved within same (or different if easier folder)
  6. i using excel 2011 (for mac) therefore file paths little different, if vba code, there should no issues of using on platform. main difference paths separated : instead of \. e.g. macintosh hd:users:documents:r7m:planning:locations

some of links have researched come close answer here:

opens txt files , saves excel : tried changing of information

looping through files in folder mac : advanced, reference need used. wasn't allowed post 3 links site gives references... think.

this (from link 1) may closest thing need...

private sub commandbutton1_click()  dim myfolder string  dim myfile string  dim foldername string   application.filedialog(msofiledialogfolderpicker)  .allowmultiselect = false  if .show = -1   foldername = .selecteditems(1)  end if  end   myfile = dir(foldername & "\*.txt")   while myfile <> ""  workbooks.opentext filename:=foldername & "\" & myfile 'save excel file  activeworkbook.saveas filename:=foldername & "\" & replace(myfile, ".txt", ".xls") 'use below 3 lines if want close workbook right after saving, dont have lots     of workbooks opened  application.displayalerts = false  activeworkbook.close  application.displayalerts = true  myfile = dir  loop end sub 

any great!


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -