Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Hi Felipe:

I interested in make a macro like this because I've had in past jobs to
work with files generated with other system in .txt format. They are a
lot and I had to open and got their data to paste on a spreadsheat for
working with them. Those files generated each month with the same
structure but different information. I could make a macro where I put
the generic name of each file for getting that information. I could
change the name of files generated each month with a program to allow
change names of file in group (To put the generic name that I input in
the macro).  

This is why I want to know how make this macro,

Regards,

Jorge Rodríguez

El dom, 28-08-2016 a las 14:08 +0200, Felipe T. Dorado escribió: 
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  : )


-- 
Atentamente,

Jorge Rodríguez


-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.