Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Odd behaviour in Excel SaveAs
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Odd behaviour in Excel SaveAs
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01132777
Message ID:
01132777
Vues:
68
Hi,

I have a strange problem when calling the SaveAs function of excel 2003. In our applications we have the following function
FUNCTION format_xls()
PARAMETERS lcFileSave

oExcel = CREATEOBJECT("Excel.Application")
oExcel.DisplayAlerts = .F.
oWorkbook = GETOBJECT(lcFileSave)
oWorkbook.WINDOWS[1].ACTIVATE()
oSheet=oWorkbook.activesheet
** format row/cols
oWorkbook.activesheet.ROWS[1].FONT.bold=.T.
** autofit columns- 30=arbitrary
FOR I = 1 TO 30
    WITH oWorkbook.activesheet.COLUMNS[i]
	.AUTOFIT()
	.COLUMNWIDTH =.COLUMNWIDTH + 1
    ENDWITH
ENDFOR
oSheet.RANGE("A2").SELECT
oWorkbook.WINDOWS[1].FreezePanes=.T.
oSheet.RANGE("A1:T1").AutoFilter
oWorkbook.SaveAs(lcFileSave,-4143)		&&Re-save file as current excel version, else truncates results>16,000 odd
oWorkbook.CLOSE()
** quit and release
oExcel.QUIT()
RELEASE ALL LIKE o*
This works fine when lcFileSave is in the format "F:\HOME\filename.xls". However if the paramater is of the construct "\\servername\volume\directory\filename.xls" we encouter OLE dipatch errors.

Any ideas on how best to resolve this ?

Thanks

William
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform