2016-07-28 4 views
1

Wie kann ich das Makro im "Quellarbeitsblatt" deaktivieren?VBA: Deaktivieren eines Makros in einer Quellarbeitsmappe

With ThisWorkbook         ' enable this workbook 
    Sheets.Add.Name = "Flow_table"    ' add worksheet to be used here 
    Sheets.Add.Name = "TP_loc"     ' add worksheet to be used here 
    ActiveSheet.Range("A1").Value = TextBox1.Value 'get the location of the source 
    ActiveSheet.Range("B1").Value = TextBox2.Value 


    Set Source = Workbooks.Open(TextBox1.Value) 
    Set Source_flow = Source.Worksheets(TextBox2.Value).Columns("A:L") 
    Set target_flow = ThisWorkbook.Worksheets("Flow_table").Columns("A:L") 

    ' **Insert a code here that will disable the MACRO of Source which is the source workbook** 

    Source_flow.Copy Destination:=target_flow  ' copy source worksheet 
    Source.Close False 

End With 

Antwort

2

Es sieht so aus, als wollten Sie verhindern, dass eine Ereignisprozedur ausgeführt wird. Sie können mit denen von Brennen stoppen:

Application.EnableEvents = False 

und dann zurückzusetzen, wenn Sie fertig sind:

Application.EnableEvents = True 
+0

Dank. Ich werde das überprüfen. :) @ThunderFrame –

+0

Cool. Danke @Thomas Inzina –

+0

Hallo @ ThunderFrame, habe ich versucht, aber das Makro aus der Quelle Arbeitsmappe ist immer noch im Konflikt mit meinem Makro. –

Verwandte Themen