View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] sbitaxi@gmail.com is offline
external usenet poster
 
Posts: 158
Default Converting xlsx to xl

On Sep 22, 3:45*pm, Patel wrote:
Thanks for the posts. That is a helpful thing to know, but I'm still
wondering if I can do it through visual basic instead of changing the
settings. I am creating this for others to use, so if that's the only
way to change it, then I will have to have all of them change their
excel options. Is there any way to do this through code for just this
macro?

Thanks again,
Stephen


Hi Stephen,

You can try toying with this snippet I got a while back from Ron De
Bruin

'Determine the Excel version and file extension/format
If Val(Application.VERSION) < 12 Then
'You use Excel 97-2003
FileExtStr = ".xls": FileFormatNum = -4143
Else
'You use Excel 2007
If SrcBk.Parent.FileFormat = 56 Then
FileExtStr = ".xls": FileFormatNum = 56
Else
FileExtStr = ".xlsx": FileFormatNum = 51
End If
End If


File format is the ID number of the extension string.


S