excel vba code to export a Microsoft Excel 97-2003 .xls file -
i trying open file user specified path using vba function.
when paste content of file desired worksheet, pastes weird unrecognizable characters in worksheet. can figure out doing wrong?
here code:
sub x_macro() '****************declaring relevant variables****************' dim t range dim path: path = application.getopenfilename("xls files (*.xls), *.xls") dim cht1 chartobject 'dim button_click vbmsgboxresult application.screenupdating = false sheets(2).activate if path = false exit sub activesheet.querytables.add(connection:="text;" & path, destination:=range("a1")) .fieldnames = true .rownumbers = true .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .textfilepromptonrefresh = false .textfileplatform = 437 .textfilestartrow = 1 .textfileparsetype = xldelimited .textfiletextqualifier = xltextqualifierdoublequote .textfileconsecutivedelimiter = false .textfiletabdelimiter = true .textfilesemicolondelimiter = true .textfilecommadelimiter = true .textfilespacedelimiter = false .textfilecolumndatatypes = array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) .textfiletrailingminusnumbers = true .refresh backgroundquery:=false end
Comments
Post a Comment