1

I am looking for a VBA macro code to add csv files to zip without using an AppleScript script. I'm able to achieve this in Windows using the below code:

Set App = CreateObject("Shell.Application")
    
App.Namespace(ZIPFILEPATH).CopyHere csvFileName

I'm looking for a similar method for macOS.

duplex143
  • 619
  • 2
  • 9
  • 25

1 Answers1

0

You can either use MacScript or Shell VBA function.

Dim shellCommand As String
Dim macScriptCommand As String
shellCommand = "zip -u -j " & zipPath & " " & csvPath
macScriptCommand = "do shell script " & """" & shellCommand & """"

You can either use Shell (shellCommand) or MacScript (macScriptCommand). There are many flavors to zip and refer the man page on how you want to zip. Note that MacScript is being deprecated as answered here.

duplex143
  • 619
  • 2
  • 9
  • 25