运行时错误';1004';将数据转换为不同Unicode时的VBE

运行时错误';1004';将数据转换为不同Unicode时的VBE,unicode,vbe,Unicode,Vbe,我在线下载了数据,但我需要将数据转换为不同的Unicode,因为数据不是英文的。 我录制了一个宏来进行数据转换。下面是我录制的宏。 我更改了源和文件名,以查看在转换新数据文件时是否可以运行宏。但是,在最后运行“.ListObject.DisplayName=“attorney36”行时,我遇到了运行时错误“1004”。我选择了“禁用所有宏并通知”单选按钮 选中“信任访问VBA项目对象模型”框,无法解决错误。 有人知道如何解决这个问题,或者知道如何编写宏将数据转换为VBE中的不同Unicode吗?

我在线下载了数据,但我需要将数据转换为不同的Unicode,因为数据不是英文的。 我录制了一个宏来进行数据转换。下面是我录制的宏。 我更改了源和文件名,以查看在转换新数据文件时是否可以运行宏。但是,在最后运行“.ListObject.DisplayName=“attorney36”行时,我遇到了运行时错误“1004”。我选择了“禁用所有宏并通知”单选按钮 选中“信任访问VBA项目对象模型”框,无法解决错误。 有人知道如何解决这个问题,或者知道如何编写宏将数据转换为VBE中的不同Unicode吗?非常感谢

次宏()


End Sub

不同的Unicode是什么意思?这里唯一的:uni来自拉丁语,意思是一个甚至是唯一的…我需要将数据从1252:Western European(Windows)转换为65001:Unicode(UTF-8)
ActiveWorkbook.Queries.Add Name:="attorney36", Formula:= _
    "let" & Chr(13) & "" & Chr(10) & "    Source = Csv.Document(File.Contents(""C:\Temporary\attorney36.csv""),[Delimiter="","", Columns=6, Encoding=65001, QuoteStyle=QuoteStyle.None])," & Chr(13) & "" & Chr(10) & "    #""Promoted Headers"" = Table.PromoteHeaders(Source, [PromoteAllScalars=true])," & Chr(13) & "" & Chr(10) & "    #""Changed Type"" = Table.TransformColumnTypes(#""Promoted H" & _
    "eaders"",{{"""", Int64.Type}, {""id"", Int64.Type}, {""title"", type text}, {""publishdate"", type text}, {""url"", type text}, {""content"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & "    #""Changed Type"""
ActiveWorkbook.Worksheets.Add
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
    "OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=attorney36;Extended Properties=""""" _
    , Destination:=Range("$A$1")).QueryTable
    .CommandType = xlCmdSql
    .CommandText = Array("SELECT * FROM [attorney36]")
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .PreserveColumnInfo = True
    .Refresh BackgroundQuery:=False
    .ListObject.DisplayName = "attorney36"
End With