Ask Your Question

Guilty_Spark_343's profile - activity

2020-05-29 23:07:42 +0200 received badge  Student (source)
2018-08-24 09:41:19 +0200 received badge  Famous Question (source)
2018-08-24 09:41:19 +0200 received badge  Notable Question (source)
2018-01-17 22:48:40 +0200 received badge  Popular Question (source)
2018-01-17 15:42:39 +0200 commented answer Calc Macros: Multiple Optional Parameters

Hi, thank you, that solved my issue! About ByRef: I like to write my code as explicitly as possible. It forces me to a

2018-01-17 15:42:12 +0200 answered a question Calc Macros: Multiple Optional Parameters

Hi, thank you, that solved my issue! About: ByRef: I like to write my code as explicitly as possible. It forces me to

2018-01-17 15:37:51 +0200 marked best answer Calc Macros: Multiple Optional Parameters

Hi,

i want to use a Sub with multiple optional paramters in LibreOffice Calc like this:

Sub test(_
ByRef mandatory As String, _
Optional ByRef optional1 As String, _
Optional ByRef optional2 As String)

If IsMissing(optional1) Then
    msgbox "Optional Argument 1 Is missing"
Else
    msgbox "Optional Argument 1 is: " & optional1
End If

End Sub

Now i want to call this Sub while not using the first optional paramter "optional1"

test("abc",,"def")

To my suprise IsMissing(optional) does not detect that "optional1" is missing. Instead the macro acts like "optional1" is existing and gives me the message box telling me "Optional Argument 1 is: Error |".

How do i handle subs with multiple optional paramters?

2018-01-17 14:34:05 +0200 asked a question Calc Macros: Multiple Optional Parameters

Calc Macros: Multiple Optional Parameters Hi, i want to use a Sub with multiple optional paramters in LibreOffice Calc

2017-11-06 18:23:58 +0200 received badge  Famous Question (source)
2017-08-04 10:15:16 +0200 commented answer Change text encoding for reading from text file (Macro)

Hi Regina, big thanks again! This code works for me and solved my problem! You asked what i want to do with the lines

2017-08-04 09:53:06 +0200 received badge  Famous Question (source)
2017-08-04 09:52:46 +0200 received badge  Enthusiast
2017-08-02 16:17:41 +0200 edited answer Change text encoding for reading from text file (Macro)

Thank you Regina, we are getting closer! i determined the FilterOptions i need for my text file by manually opening it

2017-08-02 16:17:34 +0200 edited answer Change text encoding for reading from text file (Macro)

Thank you Regina, we are getting closer! i determined the FilterOptions i need for my text file by manually opening it

2017-08-02 16:15:53 +0200 marked best answer Change text encoding for reading from text file (Macro)

Hi,

i have written a macro that reads line after line of a text file into a string variable:

open file_name for input as file_number
line input #file_number, string_variable

In order to be imported correctly, my text file has to be interpreted as ANSI encoded. However Libre Office seems to interpret it as UTF-8 encoded. This causes certain special characters (e.g. ä, ß ...) to be incorrectly displayed as some strange (?) symbol.

How can i make Libre Office interpret my text file as ANSI encoded?

EDIT: I realise that i have to use code that looks somewhat like this:

Dim MyDoc As Object
Dim props(1) As New com.sun.star.beans.PropertyValue
Dim File_Number As Integer
Dim String_Variable As String

props(0).Name = "FilterName"
props(0).Value = "Text - txt - csv (StarCalc)"
props(1).Name = "FilterOptions"
props(1).Value = "44,34,76,1,,1031,true,true" 
MyDoc = StarDesktop.LoadComponentFromURL(ConvertToURL("file_name.txt"), "_blank", 0, props() )

FileNo = FreeFile
Open Mydoc For Input As File_Number
Line Input #File_Number, String_Variable

Unfortunately this codes fails at "Open Mydoc For Input As File_Number". The error Message is: "BASIC runtime error. Object variable not set"

Any Ideas?

Best Regards, Sebastian

2017-08-02 16:15:53 +0200 received badge  Scholar (source)
2017-08-02 16:14:41 +0200 edited answer Change text encoding for reading from text file (Macro)

Thank you Regina, we are getting closer! i determined the FilterOptions i need for my text file by manually opening it

2017-08-02 16:14:34 +0200 edited answer Change text encoding for reading from text file (Macro)

Thank you Regina, we are getting closer! i determined the FilterOptions i need for my text file by manually opening it

2017-08-02 16:13:50 +0200 edited answer Change text encoding for reading from text file (Macro)

Thank you Regina, we are getting closer! i determined the FilterOptions i need for my text file by manually opening it

2017-08-02 16:13:40 +0200 edited answer Change text encoding for reading from text file (Macro)

Thank you Regina, we are getting closer! i determined the FilterOptions i need for my text file by manually opening it

2017-08-02 16:07:39 +0200 answered a question Change text encoding for reading from text file (Macro)

Thank you Regina, we are getting closer! i determined the FilterOptions i need for my text file by manually opening it

2017-08-02 14:58:18 +0200 received badge  Notable Question (source)
2017-08-02 09:59:33 +0200 received badge  Editor (source)
2017-08-02 09:59:33 +0200 edited question Change text encoding for reading from text file (Macro)

Change text encoding for reading from text file (Macro) Hi, i have written a macro that reads line after line of a text

2017-08-02 09:01:51 +0200 received badge  Popular Question (source)
2017-08-02 08:41:19 +0200 edited question Change text encoding for reading from text file (Macro)

Change text encoding for reading from text file (Macro) Hi, i have written a macro that reads line after line of a text

2017-08-01 15:10:11 +0200 asked a question Change text encoding for reading from text file (Macro)

Change text encoding for reading from text file (Macro) Hi, i have written a macro that reads line after line of a text

2017-07-15 08:06:06 +0200 received badge  Notable Question (source)
2017-07-14 10:59:20 +0200 commented answer Change Character Spacing using Macro

Thank you very much! Sadly i fail to use this knowledge to change the kerning for the entire sheet. I was hoping i coul

2017-07-14 10:58:01 +0200 answered a question Change Character Spacing using Macro

Thank you very much! Sadly i fail to use this knowledge to change the kerning for the entire sheet. I was hoping i coul

2017-07-13 16:22:17 +0200 received badge  Popular Question (source)
2017-07-13 14:05:14 +0200 asked a question Change Character Spacing using Macro

Change Character Spacing using Macro Hi, i want to change the character spacing in libre office calc using a macro. Th