jacky998877 Posted February 21 Share Posted February 21 (edited) SOLVED Edited February 21 by jacky998877 Link to comment Share on other sites More sharing options...
ioa747 Posted February 21 Share Posted February 21 have you try the MouseClickDrag() ? for Excel It has another safer way Local $oExcel = ObjCreate("Excel.Application") ; Create an Excel Object $oExcel.Visible = 1 ; Let Excel show itself $oExcel.WorkBooks.Add ; Add a new workbook Local $ColWidth = $oExcel.Worksheets("Sheet1").Columns("A").ColumnWidth Sleep(1000) ; Display the results $oExcel.ActiveWorkBook.ActiveSheet.Cells(2, 1).Value = "ColWidth" $oExcel.ActiveWorkBook.ActiveSheet.Cells(2, 2).Value = $ColWidth Sleep(1000) ; Display the results $oExcel.Worksheets("Sheet1").Columns("A").ColumnWidth = $ColWidth * 3 $ColWidth = $oExcel.Worksheets("Sheet1").Columns("A").ColumnWidth $oExcel.ActiveWorkBook.ActiveSheet.Cells(3, 1).Value = "ColWidth" $oExcel.ActiveWorkBook.ActiveSheet.Cells(3, 2).Value = $ColWidth ;~ $oExcel.ActiveWorkBook.Saved = 1 ; Simulate a save of the Workbook ;~ $oExcel.Quit ; Quit Excel spudw2k 1 Link to comment Share on other sites More sharing options...
jacky998877 Posted February 21 Author Share Posted February 21 33 minutes ago, ioa747 said: have you try the MouseClickDrag() ? for Excel It has another safer way Local $oExcel = ObjCreate("Excel.Application") ; Create an Excel Object $oExcel.Visible = 1 ; Let Excel show itself $oExcel.WorkBooks.Add ; Add a new workbook Local $ColWidth = $oExcel.Worksheets("Sheet1").Columns("A").ColumnWidth Sleep(1000) ; Display the results $oExcel.ActiveWorkBook.ActiveSheet.Cells(2, 1).Value = "ColWidth" $oExcel.ActiveWorkBook.ActiveSheet.Cells(2, 2).Value = $ColWidth Sleep(1000) ; Display the results $oExcel.Worksheets("Sheet1").Columns("A").ColumnWidth = $ColWidth * 3 $ColWidth = $oExcel.Worksheets("Sheet1").Columns("A").ColumnWidth $oExcel.ActiveWorkBook.ActiveSheet.Cells(3, 1).Value = "ColWidth" $oExcel.ActiveWorkBook.ActiveSheet.Cells(3, 2).Value = $ColWidth ;~ $oExcel.ActiveWorkBook.Saved = 1 ; Simulate a save of the Workbook ;~ $oExcel.Quit ; Quit Excel this seems nice , thx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now