Hola jorge : )
On Sat, 27 Aug 2016 05:47:09 +0000, jorge escribió:
J> Good evening:
' Afternoon.
I'm also interested in importing .txt files into a spreadsheet adequately.
J> I try to make a macro in Calc to insert a sheet from a file in .txt
J> format or .csv using the LO process: Record macro.
Mm. A question: are you trying to make a macro because you plan to be
importing a file regularly or is it just a one-time import?
Or are you trying to import it as an exercise on how to make macros?
J> I did it but the macro run and stop in the directory where the file is,
J> but not record the select and not open the sheet although I did when I
J> recorded the macro.
I notice that you call your .csv file a "sheet" and I think it is not
a sheet, yet, but a text file.
J> The code that the process wrotten is this, would you please guide me to
J> finish:
I'm afraid I am not that familiar yet with macros, but it seems to me that
at some point the macro will ask you to select which file to import, right?
That is, a dilague window will appear to let you choose the kind of import
(separators, ...) ... Wait, I cannot find an "Import" option in
menus. : ! ?
Let's see:
J> REM ***** BASIC *****
J>
J> sub Main
J> rem
J> ----------------------------------------------------------------------
J> rem define variables
J> dim document as object
J> dim dispatcher as object
J> rem
J> ----------------------------------------------------------------------
J> rem get access to the document
J> document = ThisComponent.CurrentController.Frame
J> dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
J>
J> rem
J> ----------------------------------------------------------------------
J> rem dispatcher.executeDispatch(document, ".uno:InsertSheetFromFile", "",
J> 0, Array())
J>
J> end sub
There, at the end you have a ".uno:InsertSheetFromFile"
¿How did you manage to "import" a file into your worksheet? I've only
managed it _opening_ a new file which is a .cvs file. And then the import
dialogue appears, I choose the options and the .csv file is correctly
imported into a worksheet.
As I say I'm not familiar with macros and don't know how that is done. But
It seems to me that perhaps you have to open a file instead of trying to
import it : ?
I hope someone who already does what you want illustrates us on what is to
be done and how.
J> I use LibreOffice version 4.2.8.2 on Ubuntu 14.04 LTS
I'm using LO Versión: 4.3.3.2 on Debian GNU/Linux 8.5.
Felipe : )
--
To unsubscribe e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted