Jump to content

using this code i can drag files to different places, but it cant be used to expand excel column , why ?


Recommended Posts

  • jacky998877 changed the title to using this code i can drag files to different places, but it cant be used to expand excel column , why ?

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

 

I know that I know nothing

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...