Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Odd behaviour in Excel SaveAs
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01132777
Message ID:
01132833
Views:
11
>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

A UNC requires there to be a sharename following the server, not a necessarily a volume name.

so it would be "\\server\sharename\folder\filename.xls"
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform