1

I need some help with importing a file. I have exported a .dpl file which contains Russian text, which is not shown by default. It shows random chars, like in the example below.

lt:3 LANG:10001 "PST requested" LANG:10027 "PST requested" LANG:10007 "ТеŃŃ‚ запроŃено" 

I run the script below to select and import the file into a new sheet, but I have no idea where to insert the code to change Charset = "utf-8"

Sub OpenAFile() 'import file

Dim fd As FileDialog
Dim homeWorkbook As Workbook
Set homeWorkbook = ActiveWorkbook
Dim targetBook As Workbook
Dim targetSheet As Worksheet

Application.DisplayAlerts = False

Set fd = Application.FileDialog(msoFileDialogOpen)

FileWasChosen = fd.Show

fd.Execute

Set targetBook = ActiveWorkbook
Set targetSheet = targetBook.Worksheets(1)

targetSheet.Copy After:=homeWorkbook.Sheets(homeWorkbook.Sheets.Count)

Application.DisplayAlerts = True

With homeWorkbook.Sheets(homeWorkbook.Sheets.Count)
    .Name = "Import"
End With

End Sub

It needs to be displayed like this:

lt:3 LANG:10001 "Limit alarm HH suppressed" LANG:10027 "Limit alarm HH suppressed" LANG:10007 "Предел - трев. оповещ-е авар. выс. ур-ня устр-но" 

Thank you for your help!

Tim Stack
  • 3,209
  • 3
  • 18
  • 39
TadejP
  • 48
  • 5
  • 2
    Only use the FileDialog to get the file name, and then open the file [with `OpenText`](https://stackoverflow.com/a/155176/11683) providing the encoding. – GSerg Feb 06 '19 at 09:32

0 Answers0