Posts: 86
Threads: 27
Joined: Jan 2008
hi all, is there a way to change the width of a column?
like in Excel to make the columns wider or smaller with a macro?
Thanks
Posts: 86
Threads: 27
Joined: Jan 2008
guess its impossible
Thanks anyway
if u find a way to do it tho, plz post
Thanks again
Posts: 262
Threads: 63
Joined: Nov 2005
Please be a little more specific and maybe give an example. Are you using QM Dialog or HTML? What you are asking should be able to be done but be more specific.
Posts: 86
Threads: 27
Joined: Jan 2008
I just want to know how to like change a whole columns width in Excel
like double the width of column A or something
Posts: 86
Threads: 27
Joined: Jan 2008
I would really like to learn to do this
so anyone that knows even a little bit how to do this
could maybe post an example code
just to change the column width, i think it might be changing it in pixels
im not exactly sure
Thanks
Posts: 262
Threads: 63
Joined: Nov 2005
Do you want something like this? It changes the column with of a new Excel workbook.
Macro
int w1=act(win("Microsoft Excel -" "XLMAIN"))
lef+ 96 155 w1
lef- 203 155 w1
OR
Do you want something like this? It changes the column with of a new Excel workbook no matter where Excel is located on the screen.
Macro
int w1=act(win("Microsoft Excel -" "XLMAIN"))
lef+ 96 33 child("" "EXCEL7" w1)
lef- 161 35 child("" "EXCEL7" w1)
Posts: 86
Threads: 27
Joined: Jan 2008
Yes that is basicaly what i want
but is there a way to do it without clicks (lef)
Posts: 12,071
Threads: 140
Joined: Dec 2002
In Excel you can record it. Use Excel's recording (menu Tools -> Macro ....). It records Excel macro, like this:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 2008.07.06 by G
'
' Keyboard Shortcut: Ctrl+y
'
ActiveCell.FormulaR1C1 = "dd"
Range("A2").Select
Columns("A:A").ColumnWidth = 34
End Sub
Excel macros can be launched from QM or converted to QM.
Posts: 262
Threads: 63
Joined: Nov 2005
Or this will work as well
Macro
Acc ColumnA=acc("" "CLIENT" win("Microsoft Excel -" "XLMAIN") "EXCEL7" "" 0x1001)
ColumnA.Mouse(1 59 10)
Acc Width=acc("Width..." "MENUITEM" win("Microsoft Excel -" "XLMAIN") "" "" 0x1001)
Width.DoDefaultAction
act win("Microsoft Excel -" "XLMAIN")
str SizeOfColumnA.getwintext(id(19 win("Column Width" "bosa_sdm_XL9")))
VARIANT NewSizeOfColumnA
NewSizeOfColumnA.mul(SizeOfColumnA 2)
_s=NewSizeOfColumnA; _s.setwintext(id(19 win("Column Width" "bosa_sdm_XL9")))
Acc PushButtonOk=acc("OK" "PUSHBUTTON" win("Column Width" "bosa_sdm_XL9") "bosa_sdm_XL9" "" 0x1001)
PushButtonOk.DoDefaultAction
Now you have two examples.
Posts: 86
Threads: 27
Joined: Jan 2008
sorry that is still not it
that makes the mouse move
i want the mouse to stay in the exact same place the whole time it moves the column
but thanks anyway