SAVE AS TYPE

376 views
Skip to first unread message

Raymond O'Donnell

unread,
Sep 6, 2013, 10:51:15 AM9/6/13
to harbou...@googlegroups.com
OEXCEL:ACTIVEWORKBOOK:SAVEAS("C:\HMGWORK\OLE\JUNK.XLS")
 
WORKS AS IMPLIED BUT HOW DO YOU SAVE THE FILE AS A DIFFERENT TYPE?
 
SAY
 
 "CSV(MS-DOS)FORMATCSV")

Klas Engwall

unread,
Sep 6, 2013, 2:27:07 PM9/6/13
to harbou...@googlegroups.com
Hi Raymond,
Here is the complete list of arguments to the SaveAs() method according
to the VBAXL9.CHM help file:

expression.SaveAs(Filename, FileFormat, Password, WriteResPassword,
ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution,
AddToMru, TextCodePage, TextVisualLayout)

And the different FileFormat constants are listed around line 980 in the
header file posted by Annibal Villalobos in today's thread about
Win_OleCreateObject(). You probably want this one:

#define xlCSV 6

Regards,
Klas

Raymond O'Donnell

unread,
Sep 8, 2013, 1:59:30 AM9/8/13
to harbou...@googlegroups.com
Klas Engwall
 
I am sorry to trouble you again but I am still unable to compile this.
 
I am using Windows 7 32 bit
I normally use HMG Forum but it has been suggested I tried Harbour
I compile with HMG 3.1.0
I get the following error
 
Harbour 3.2.0dev (Rev. 18443)
Copyright (c) 1999-2012, http://harbour-project.org/
C:\HMGWORK\TEST\test.prg(30) Error E0030  Syntax error "syntax error at '24'"
1 error
No code generated.
hbmk2: Error: Running Harbour compiler (embedded). 1
(C:\hmg.3.1.0\harbour\bin\harbour.exe) -n2 C:\HMGWORK\TEST\main.prg C:\HMGWORK\TEST\test.prg -q -oC:\Users\Rosemary\AppData\Local\Temp\hbmk_4vdl5b.dir\ -iC:\hmg.3.1.0\harbour\include -i. -iC:\hmg.3.1.0\include
My PRG file is with some of the many examples I have tried.
 
 
 
 
 
*******************************************************************************
*WRITTEN.......:- Fri, 6 September 2013 12:08:03 GMT
*MODIFIED......:- Sun, 8 September 2013 05:37:40 GMT
*
*******************************************************************************
#include <hmg.ch>
*******************************************************************************
PROCEDURE TEST_BLANK()
LOCAL OExcel, oJpg
#define xlCSVMSDOS 24
   oExcel := CreateObject( "Excel.Application" )
   oExcel:WorkBooks:OPEN("C:\HMGWORK\TEST\JPGATTRIB.xls")
   oJpg := oExcel:ActiveSheet()
   oJpg:Cells:Font:Name := "Arial"
   oJpg:Cells:Font:Size := 12
// OEXCEL:ACTIVEWORKBOOK:SAVEAS("C:\HMGWORK\TEST\XYZ"), FILEFORMAT xlcsv
// OEXCEL:ACTIVEWORKBOOK:SAVEAS("C:\HMGWORK\TEST\XYZ", FILEFORMAT xlcsv)
// OEXCEL:ACTIVEWORKBOOK:SAVEAS("C:\HMGWORK\TEST\XYZ", FILEFORMAT xlCSVMSDOS)
// Refer line 983 in chart
// OEXCEL:ACTIVEWORKBOOK:SAVEAS("C:\HMGWORK\TEST\XYZ.CSV", FILEFORMAT xlCSVMSDOS)
// OEXCEL:ACTIVEWORKBOOK:SAVEAS("C:\HMGWORK\TEST\XYZ.CSV", FileFormat xlCSVMSDOS)
OEXCEL:ACTIVEWORKBOOK:SAVEAS("C:\HMGWORK\TEST\XYZ.CSV" : FileFormat xlCSVMSDOS)

OEXCEL:ACTIVEWORKBOOK:CLOSE()
OEXCEL:QUIT()
GOODBYE()
*******************************************************************************
*END

Bernard Mouille [w]

unread,
Sep 8, 2013, 3:40:44 AM9/8/13
to harbou...@googlegroups.com

Try this

 

OEXCEL:ACTIVEWORKBOOK:SAVEAS( "C:\HMGWORK\TEST\XYZ.CSV", xlCSVMSDOS )

 

A sample that I use ( you have not all the variables )

 

//

 

MAKEDIR( Dossier )                                                                      && Crée le dossier de sortie s'il n'existe pas.

oExcel:DisplayAlerts := .F.

oExcel:ActiveWorkbook:SaveAs( Dossier + "\Ventes_" + STRZERO( MOIS, 2, 0 ) + "_" + STR( ANNEE, 4, 0 ) + "_" + SECTEUR, xlAddIn )

oExcel:DisplayAlerts := .T.

oExcel:Quit()

 

//

 

Bernard

 


De : harbou...@googlegroups.com [mailto:harbou...@googlegroups.com] De la part de Raymond O'Donnell
Envoyé : dimanche 8 septembre 2013 08:00
À : harbou...@googlegroups.com
Objet : [harbour-users] Re: SAVE AS TYPE

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
 
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Bernard Mouille [w]

unread,
Sep 8, 2013, 3:45:12 AM9/8/13
to harbou...@googlegroups.com

The constants to SaveAs() Excel :

 

*

* Constantes Excel FileFormat -> SaveAs( FileName, FileFormat )

*

#define xlAddIn                       18  && Microsoft Excel 97-2003 Add-In

#define xlAddIn8                      18  && Microsoft Excel 97-2003 Add-In

#define xlCSV                          6  && CSV

#define xlCSVMac                      22  && Macintosh CSV

#define xlCSVMSDOS                    24  && MSDOS CSV

#define xlCSVWindows                  23  && Windows CSV

#define xlCurrentPlatformText      -4158  && Current Platform Text

#define xlDBF2                         7  && DBF2

#define xlDBF3                         8  && DBF3

#define xlDBF4                        11  && DBF4

#define xlDIF                          9  && DIF

#define xlExcel12                     50  && Excel12

#define xlExcel2                      16  && Excel2

#define xlExcel2FarEast               27  && Excel2 FarEast

#define xlExcel3                      29  && Excel3

#define xlExcel4                      33  && Excel4

#define xlExcel4Workbook              35  && Excel4 Workbook

#define xlExcel5                      39  && Excel5

#define xlExcel7                      39  && Excel7

#define xlExcel8                      56  && Excel8

#define xlExcel9795                   43  && Excel9795

#define xlHtml                        44  && HTML format

#define xlIntlAddIn                   26  && International Add-In

#define xlIntlMacro                   25  && International Macro

#define xlOpenDocumentSpreadsheet     60  && OpenDocument Spreadsheet

#define xlOpenXMLAddIn                55  && Open XML Add-In

#define xlOpenXMLTemplate             54  && Open XML Template

#define xlOpenXMLTemplateMacroEnabled 53  && Open XML Template Macro Enabled

#define xlOpenXMLWorkbook             51  && Open XML Workbook

#define xlOpenXMLWorkbookMacroEnabled 52  && Open XML Workbook Macro Enabled

#define xlSYLK                         2  && SYLK

#define xlTemplate                    17  && Template

#define xlTemplate8                   17  && Template 8

#define xlTextMac                     19  && Macintosh Text

#define xlTextMSDOS                   21  && MSDOS Text

#define xlTextPrinter                 36  && Printer Text

#define xlTextWindows                 20  && Windows Text

#define xlUnicodeText                 42  && Unicode Text

#define xlWebArchive                  45  && Web Archive

#define xlWJ2WD1                      14  && WJ2WD1

#define xlWJ3                         40  && WJ3

#define xlWJ3FJ3                      41  && WJ3FJ3

#define xlWK1                          5  && WK1

#define xlWK1ALL                      31  && WK1ALL

#define xlWK1FMT                      30  && WK1FMT

#define xlWK3                         15  && WK3

#define xlWK3FM3                      32  && WK3FM3

#define xlWK4                         38  && WK4

#define xlWKS                          4  && Worksheet

#define xlWorkbookDefault             51  && Workbook default

#define xlWorkbookNormal           -4143  && Workbook normal

#define xlWorks2FarEast               28  && Works2 FarEast

#define xlWQ1                         34  && WQ1

#define xlXMLSpreadsheet              46  && XML Spreadsheet

 


De : harbou...@googlegroups.com [mailto:harbou...@googlegroups.com] De la part de Raymond O'Donnell
Envoyé : dimanche 8 septembre 2013 08:00
À : harbou...@googlegroups.com
Objet : [harbour-users] Re: SAVE AS TYPE

 

Klas Engwall

--

Raymond O'Donnell

unread,
Sep 8, 2013, 6:22:07 AM9/8/13
to harbou...@googlegroups.com
Just a short note to say thank you very much to Klas Engwall and Bernard Mouille for their help.
 
It was very much appreciated.
 
What has take me days and days has been resolved in seconds.
 
Everything becomes obvious when you remove the blindfolds.

Dragan Cizmarevic

unread,
Sep 9, 2013, 5:31:30 AM9/9/13
to harbou...@googlegroups.com
Does anyone have a version of it for Open Office Calc?

Klas Engwall

unread,
Sep 9, 2013, 6:04:55 AM9/9/13
to harbou...@googlegroups.com
Hi Dragan,

> Does anyone have a version of it for Open Office Calc?

Do you mean the docs for the OOO API? Try this page to begin with:

http://www.openoffice.org/api/SDK/

Regards,
Klas

Bernard Mouille [w]

unread,
Sep 9, 2013, 7:59:32 AM9/9/13
to harbou...@googlegroups.com

Hello Dragan,

 

I have something, but it is writed in dBasePlus.

I have no time to translate for instance.

I you use the save function of Open Office, you must to put a delay of 2 seconds afer.

 

Bernard

 


De : harbou...@googlegroups.com [mailto:harbou...@googlegroups.com] De la part de Dragan Cizmarevic
Envoyé : lundi 9 septembre 2013 11:32


À : harbou...@googlegroups.com
Objet : [harbour-users] Re: SAVE AS TYPE

 

Does anyone have a version of it for Open Office Calc?


Reply all
Reply to author
Forward
0 new messages