Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel VBA编译错误:在Mac上找不到带有按钮的方法或数据成员_Excel_Macos_Vba_Excel 2011 - Fatal编程技术网

Excel VBA编译错误:在Mac上找不到带有按钮的方法或数据成员

Excel VBA编译错误:在Mac上找不到带有按钮的方法或数据成员,excel,macos,vba,excel-2011,Excel,Macos,Vba,Excel 2011,我有一个在Windows(office 2007)上工作的vba脚本,我现在在Mac(office 2011)上使用它 在Windows上一切正常,但我有一个按钮无法运行的问题 运行时,我发现一个方法或数据成员未找到错误,第一个lign以黄色突出显示,并且.Filters.Clear 以灰色突出显示 我不知道问题出在哪里 谢谢你的帮助 Sub Button5_Click() Application.ScreenUpdating = False 'à mettre en début de ch

我有一个在Windows(office 2007)上工作的vba脚本,我现在在Mac(office 2011)上使用它

在Windows上一切正常,但我有一个按钮无法运行的问题

运行时,我发现一个方法或数据成员未找到错误,第一个lign以黄色突出显示,并且.Filters.Clear 以灰色突出显示

我不知道问题出在哪里

谢谢你的帮助

 Sub Button5_Click()

Application.ScreenUpdating = False 'à mettre en début de chaque macro !!!

If CommandButton5 = Click Then

 ChDir ("Marcin2:Comptasoft:ListingClient")

'Declare a variable as a FileDialog object.
Dim fd As FileDialog

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)

'Declare a variable to contain the path of each selected item. Even though the path is a String,
'the variable must be a Variant because For Each...Next routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant

'Use a With...End With block to reference the FileDialog object.
With fd

    'Change the contents of the Files of Type list.
    'Empty the list by clearing the FileDialogFilters collection.
    .Filters.Clear

    'Add a filter that includes all files.
    .Filters.Add "Fichiers texte", "*.txt"


    'Use the Show method to display the File Picker dialog box and return the user's action.
    'The user pressed the action button.
    If .Show = -1 Then

        'Step through each String in the FileDialogSelectedItems collection.
        For Each vrtSelectedItem In .SelectedItems

'nom du fichier (adresse)
temp = vrtSelectedItem

'ouverture du fichier a revoir sous une feuille excel
            Workbooks.OpenText Filename:=temp, _
DataType:=xlDelimited, Tab:=True

        Next vrtSelectedItem
    'The user pressed Cancel.

    End If
End With

'Set the object variable to Nothing.
Set fd = Nothing



'Copie le nouveau nom du client sur la facture Client (feuil1)

Range("A2:a5").Select
Selection.Copy
Windows("Facturation.xlsm").Activate
Range("B19:b22").Select
ActiveSheet.Paste
Range("c19:c22").ClearContents

'fermer le fichier txt
Workbooks(2).Close
Workbooks(1).Worksheets(1).Activate

End If
Application.ScreenUpdating = True 'à mettre à la fin de chaque macro !!!


End Sub

你喜欢解决这个问题吗?你喜欢解决这个问题吗?