Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

ANSI coding in textfile from macro

Hi everyone,

I have this macro (VBScript) in which I export a table into a textfile:

Sub ExportToTextfile

    Set tableObject = ActiveDocument.GetSheetObject("TB01")

    tableObject.Export "C:/TEST.txt",Chr(9)

End Sub

My problem is that the exported file has an UTF-8 encoding. I would like to export into ANSI encoding, or convert it into ANSI encoding if possible. Anybody here that knows this?

Best regards,

Filip

1 Solution

Accepted Solutions
marcus_sommer

Maybe it's also connected with the user-properties about the charset within the tab export ...

- Marcus

View solution in original post

11 Replies
marcus_sommer

There are two further parameter after the delimiter-parameter possible - the codepage and appending to an existing file with true/false.

Codepage number, e.g. :
0          =   current ANSI
1200     =   Unicode
65001   =   UTF-8

- Marcus

Anonymous
Not applicable
Author

I don't get it... In what context should I use the 0 codepage?

marcus_sommer

...

tableObject.Export "C:/TEST.txt",Chr(9), 0

...

- Marcus

Anonymous
Not applicable
Author

Thanks... But unfortunately i still get UTF-8 encoding...

marcus_sommer

In regard to the APIGuide.qvw it should work. You could also try it with "ExportEx" - see the picture.

- Marcus

jerrysvensson
Partner - Specialist II
Partner - Specialist II

This works, just tried it.


Sub ExportToTextfile
Set tableObject = ActiveDocument.GetSheetObject("TB28")
tableObject.Export "C:\TEST.txt",",",0
End Sub

Anonymous
Not applicable
Author

Doesn't work for me actually, seems strange...

marcus_sommer

Maybe it's also connected with the user-properties about the charset within the tab export ...

- Marcus

Anonymous
Not applicable
Author

Yes, you are correct Marcus!

Thanks a lot!!

But does this setting affect regular export from charts to excel (such as pivot tables) or only text file exports?

Best,

Filip