Posted 8 September 2017, 1:48 pm EST
I have a spread using spread 7 that I am exporting to an excel formatted file. In the spread I have 2 columns (g and h) that are defined as date. I have another column that is defined as a number with the formula sum(g#-h#) which gives me the result of the number of days difference between the to columns defined as date. The formula works perfect in the spread. However when I export the spread to Excel, the formulas do not export. I have listed the code that I use to export the spread at the bottom.
Am I doing something wrong code wise, or is this a problem with spread 7?
Code used to export the spread to excel formatted file:
Public Sub ExportFileToExcel(objfpspread1 As fpSpread)
objfpspread1.ExportExcelBook strfilename & ".XLS"
Dim objExcel As Excel.Application
Dim objBook As Excel.Workbook
Dim objsheet As Excel.Worksheet
Dim objrange As Excel.Range
Set objExcel = New Excel.Application
Set objBook = objExcel.Workbooks.Open(strfilename & ".XLS")
Set objsheet = objBook.Sheets(1)
objfpspread1.Col = 1
objfpspread1.Row = 1
Dim x As Integer
For x = 1 To objfpspread1.MaxCols
objfpspread1.Col = x
objsheet.Range(Chr(64 + x) & "1").Value = objfpspread1.Text
objsheet.Range("A1:" & Chr( _
64 + objfpspread1.MaxCols) & objfpspread1.MaxRows + 1).Locked = False
objsheet.Protect Contents:=False, UserInterfaceOnly:=True, AllowFormattingCells:=True, AllowFormattingColumns:=True
Set objsheet = Nothing
Set objBook = Nothing
Set objExcel = Nothing
Any help is greatly appreciated.