View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
socrtwo socrtwo is offline
external usenet poster
 
Posts: 16
Default How Do I Use List Box for VBA Script that Converts Excel Files to Any FIle Type?


Bob Phillips wrote:
That is probably because you have loaded the listbox with the constant
names, but it is the constant value that is used by the VBA statement.

Create a 2 column list, one with the names, one with the value, like so,

xlAddin 18
xlCSV 6
etc.

and set the listbox to reference this list, then in the code use

ActiveWorkbook.SaveAs _
Filename:=Left(myfiles(i), Len(myfiles(i)) - 4) & "_" _
& wks.Name, _

FileFormat:=lbxExcelFileClass.List(lbxExcelFileCla ss.Listindex,1)


Bob, thanks for replying. I see I may be asking for a value when it's
really a string I'm looking for. I looked up the table of the class
values he
http://msdn.microsoft.com/library/de...HV01049962.asp
and replaced my table with that one.
I put in you code to replace mine and still got the error.

I looked up the error and it seems that since I started my code with
"Options Explicit", I needed to Dim the variable. So my question is,
can I keep my list which explains what each xl[file type] in the second
column, if I just Dim lbxExcelFileClass as a string?
Also, how do I make sure the form gets displayed?

If I put back my table the way it was originally and Dim
lbxExcelFileClass as a string and make
FileFormat:=lbxExcelFileClass.String. I get another compile error:
"invalid qualifier.
Any ideas?