/ / Öffnen und Anzeigen eines Excel-Makros in Ubuntu oder R -, Excel, Excel-Vba, Ubuntu-16.04, Vba

Öffnen und Anzeigen eines Excel-Makros in Ubuntu oder R -, Excel, Excel-Vba, Ubuntu-16.04, Vba

Ich habe ein Excel-Makro zusammen mit einem übergebenBeispiel-Dataset, auf dem das Makro ausgeführt wird, und ich muss die Verarbeitungsschritte replizieren und hinzufügen, die es in R ausführt. Ich verwende Ubuntu auf meinem Computer und ich habe keine Erfahrung mit Windows noch Excel. Ist es möglich, zu öffnen das Makro in Ubuntu oder in R und herauszufinden, was es tut? Wenn ja, weiß jemand wie? Danke!

Antworten:

0 für die Antwort № 1

Ich habe nur den folgenden Code und es funktioniert gut.

library(RDCOMClient)

# Open a specific workbook in Excel:
xlApp <- COMCreate("Excel.Application")
xlWbk <- xlApp$Workbooks()$Open("C:\Users\Excel\Desktop\Condo.xls")

# this line of code might be necessary if you want to see your spreadsheet:
xlApp[["Visible"]] <- TRUE

# Run the macro called "MyMacro":
xlApp$Run("MyMacro")

# Close the workbook and quit the app:
xlWbk$Close(FALSE)
xlApp$Quit()

# Release resources:
rm(xlWbk, xlApp)
gc()

Natürlich führen Sie es von R aus. Siehe auch den unten stehenden Link, um ein Makro in Excel automatisch auszulösen, wenn eine Arbeitsmappe geöffnet wird.

https://analysistabs.com/excel-vba/run-macro-automatically-opening-workbook/

"The following Macro sits in the "ThisWorkbook" module.
Private Sub Workbook_Open()
Msgbox "Welcome to ANALYSIS TABS"
End Sub