WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Resize child windows in Excel

 Keywords:  

Question:

The Function WinPlace doesn't seem to affect child windows. I need to change child window sizes in Excel.

I recorded how to do this in Excel VBA:

    Windows("Book1").Activate
    With ActiveWindow
        .Top = 231.25
        .Left = 7.75
    End With
    With ActiveWindow
        .Width = 267.75
        .Height = 415.5
    End With

Can you help me to feed translate this VB code to WinBatch OLE commands?

Answer:

Try This

source_xls = "C:\WINDOWS\DESKTOP\OLE-ADO-ADOX\OLE\OLE_types.xls" 
ExcelWS = ObjectOpen("Excel.Application") ; Open Excel using values from Registry.
														; The path to Excel is found from the Registry.
														; Not in Registry? Reinstall Excel, or modify registry
														; from another WinBatch script. Be careful.

ExcelWS.visible = @true                   ; Property set to visible to see Excel. Otherwise
														; Excel will start and run hidden.
EWB = ExcelWS.Workbooks
EWB.Open (source_xls)
WBA = ExcelWS.ActiveWorkbook
WBA.Activate
WIN = WBA.Windows(1)
WINA = WIN.Activate
WINACT = ExcelWS.ActiveWindow
WINACT.Top = 231.25
WINACT.Left = 7.75
WINACT.Width = 267
WINACT.Height = 415.5
exit



Article ID:   W14931
File Created: 2001:11:08:12:41:00
Last Updated: 2001:11:08:12:41:00