This would be useful mainly to someone who needs to frequently import excel data to alpha, and wants to get around having to manually open it and save as version 4.0
I have run it on XP-Pro, XP-Home, and 2000 successfully, but not with ALL vesions of office. If you have Office 2000 or 97, let me know if it works there, as well, and on 98 and ME.
the function is from the work of John Mango, Tim Stephens, and Bill Parker(unknowingly) - I robbed one of his lines!
the function:
FUNCTION excelconvert AS C(excelname AS C, newname AS C)
Dim xlApp as p
xlApp = ole.create("Excel.Application")
xlApp.Visible=.f. 'this line doesn't completely stop a momentary flash-display
xlApp.Workbooks.Open(excelname)
xlApp.displayalerts=.f.
xlApp.ActiveWorkbook.SaveAs(newname,33) '33 is a constant for Excel 4.0
xlApp.Workbooks.Close()
xlApp.Quit()
delete xlApp
END FUNCTION
an example use:
newname="c:\fischer\source1.xls"
if file.exists(newname)
file.remove(newname)
end if
xbasic_wait_for_idle()
'function to convert to 4.0
excelconvert("c:\fischer\source.xls", "c:\fischer\source1.xls")
xbasic_wait_for_idle()
import.run_silent("awsource")
I have now silently converted and imported to Alpha.
The above works perfectly on a stand-a-lone. If you need to use it on a network, here is the code I use:
if *any(:a5.get_path(),"shadow")
excelname = filename_decode(word(a5.get_master_path(),1,"\\",w_count(a5.get_master_path(),"\\")-1) + chr(92)+ "source.xls")
newname = filename_decode(word(a5.get_master_path(),1,"\\",w_count(a5.get_master_path(),"\\")-1) + chr(92)+ "source1.xls")
' ui_msg_box("","shadowed " + import_filename)
else
excelname = filename_decode(word(a5.get_path(),1,"\\",w_count(a5.get_path(),"\\")-1) + chr(92)+ "source.xls")
newname = filename_decode(word(a5.get_path(),1,"\\",w_count(a5.get_path(),"\\")-1) + chr(92)+ "source1.xls")
' ui_msg_box("","NOT SHADOWED " + import_filename)
end if
ui_msg_box("","" + excelname + crlf() + newname)
'function to convert to 4.0
excelconvert(excelname, newname)
I have run it on XP-Pro, XP-Home, and 2000 successfully, but not with ALL vesions of office. If you have Office 2000 or 97, let me know if it works there, as well, and on 98 and ME.
the function is from the work of John Mango, Tim Stephens, and Bill Parker(unknowingly) - I robbed one of his lines!
the function:
FUNCTION excelconvert AS C(excelname AS C, newname AS C)
Dim xlApp as p
xlApp = ole.create("Excel.Application")
xlApp.Visible=.f. 'this line doesn't completely stop a momentary flash-display
xlApp.Workbooks.Open(excelname)
xlApp.displayalerts=.f.
xlApp.ActiveWorkbook.SaveAs(newname,33) '33 is a constant for Excel 4.0
xlApp.Workbooks.Close()
xlApp.Quit()
delete xlApp
END FUNCTION
an example use:
newname="c:\fischer\source1.xls"
if file.exists(newname)
file.remove(newname)
end if
xbasic_wait_for_idle()
'function to convert to 4.0
excelconvert("c:\fischer\source.xls", "c:\fischer\source1.xls")
xbasic_wait_for_idle()
import.run_silent("awsource")
I have now silently converted and imported to Alpha.
The above works perfectly on a stand-a-lone. If you need to use it on a network, here is the code I use:
if *any(:a5.get_path(),"shadow")
excelname = filename_decode(word(a5.get_master_path(),1,"\\",w_count(a5.get_master_path(),"\\")-1) + chr(92)+ "source.xls")
newname = filename_decode(word(a5.get_master_path(),1,"\\",w_count(a5.get_master_path(),"\\")-1) + chr(92)+ "source1.xls")
' ui_msg_box("","shadowed " + import_filename)
else
excelname = filename_decode(word(a5.get_path(),1,"\\",w_count(a5.get_path(),"\\")-1) + chr(92)+ "source.xls")
newname = filename_decode(word(a5.get_path(),1,"\\",w_count(a5.get_path(),"\\")-1) + chr(92)+ "source1.xls")
' ui_msg_box("","NOT SHADOWED " + import_filename)
end if
ui_msg_box("","" + excelname + crlf() + newname)
'function to convert to 4.0
excelconvert(excelname, newname)