Is there anyone who can help me convert a VBA code to Google Apps Script.
This code works perfectly in Excel, but now people also want it in Google Workspace
See the VBA code below.
Sub Bestand_invoegen()
Sheets("Orginele lijst").Activate
Cells.ClearContents
Sheets("Bestand invoegen").Activate
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse voor je bestand & Import Range", FileFilter:="Excel Files (*.xls*),*xls*")
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
OpenBook.Sheets(1).Range("A1:N50").Copy
ThisWorkbook.Worksheets("Orginele lijst").Range("A1").PasteSpecial xlPasteValues
OpenBook.Close False
End If
Application.ScreenUpdating = True
Sheets("Orginele lijst").Activate
Range("E2:N50") = Range("E2:N50").Value
Sheets("Bestand invoegen").Activate
End Sub
Thanks
I tried Google’s “Macro Converter” add-on. But that didn’t work because I don’t have an Enterprice license.
The code erases the data from a particular sheet and then opens a selection screen to select a file from which a specific range is selected and copied to the erased sheet.
I’ve scoured the internet for solutions but each time it opens Google Drive and not the local drive. Because that is where the files from which the data must come are located. In Excel this is all possible with no problem.
Can anyone help me get this done in Google Apps Script.
Thanks
Dominique Moons is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.