Return to site

Cannot run vbs script

broken image

broken image

Range(Selection, Selection.End(xlUp)).SelectĪctiveSheet.Range('A:A').RemoveDuplicates Columns:=1, Header:=xlYes Sheets('Sheet1').Range('A:K,M:Q').EntireColumn.Delete Sub sbVBS_To_Delete_Specific_Multiple_Columns() SbVBS_To_Delete_Specific_Multiple_Columns Workbooks.Open 'C:\Users\user\Desktop\Entry reports Last 24hrs\employees-in-last-24hours.xls' Set xlsxWorkbook = ('C:\Users\user\Desktop\Entry reports Last 24hrs\employees-in-last-24hours.xls') Set xlsxApp = CreateObject('Excel.Application') Lastly, the file being sent is unique in that it is written over every day before it's modified and emailed.

broken image

I'm somewhat confused though because if I' m calling the macro with the VBS script, then why would it matter if it was loaded in the worksheet or not? It should run because it was called. I'll admit that I have about 50% understanding of what's happening with all of these scripts, but I can tell you that when the Macro is run manually and independently, it works just fine. I have a VBS script calling for an Excel Macro that opens a Workbook, modifies some columns, saves the workbook, and then emails it to someone.

broken image