Hi,
I'm trying to get the following to work:
It doesn't seem to like the line: objExcel.ActiveSheet.Columns("D:D").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Is there something wrong with it?
Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = False
strWB = "C:\Test\admin make busy."
Set objWorkbook = objExcel.Workbooks.Open(strWB & "xls")
objExcel.ActiveSheet.Rows("1:7").Delete
objExcel.ActiveSheet.Columns("D:D").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
objExcel.ActiveSheet.Columns("K").Delete
objExcel.ActiveSheet.Columns("I").Delete
objExcel.ActiveSheet.Columns("C:F").Delete
objExcel.ActiveWorkbook.Save
objExcel.Quit
Thx,
John
VBScript query
Moderators: Dorian (MJT support), JRL
Re: VBScript query
Hi, I modified it slightly, hope it helps.
Code: Select all
VBSTART
Sub Test
Set objExcel = CreateObject("Excel.Application")
xlCTB=4 'Constant for xlCellTypeBlanks = 4
objExcel.DisplayAlerts = False
strWB = "C:\Test\admin make busy."
Set objWorkbook = objExcel.Workbooks.Open(strWB & "xls")
objWorkbook.ActiveSheet.Rows("1:7").Delete
on error resume next
objWorkbook.ActiveSheet.Columns("D:D").SpecialCells(xlCTB).EntireRow.Delete
objWorkbook.ActiveSheet.Columns("K").Delete
objWorkbook.ActiveSheet.Columns("I").Delete
objWorkbook.ActiveSheet.Columns("C:F").Delete
objWorkbook.Save
objWorkbook.Close
End Sub
VBEND
VBRun>Test