View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Open a semi variable name with a macro

I would let the user select the file:

option explicit
sub testme()
dim myFileName as variant
dim newwkbk as workbook

myfilename = application.getopenfilename("CSV files, *.csv")
if myfilename = false then
exit sub
end if

set curwks = activesheet

set newwkbk = workbooks.open(filename:=myfilename)

'...do some real work

end sub

Don Seegers wrote:

I want to open a semi variable file name with a macro, the 1st characters are
variable the last ones are not, this is the form of the filename : "20060111
- cf_011106_110818_cgcflh.CSV"

everything but cgcflh is variable but is always in the same format,

can anyone help me ??

--
Don Seegers


--

Dave Peterson