Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workbook dimensions

Status
Not open for further replies.

MeldrethMan

Technical User
Feb 3, 2012
69
GB
I'm sending data to Excel from an Access selector form and would like to control the workbook dimensions so it is visible without scrolling.

This is the early part of the code for exporting

Dim objXL As Excel.Application
Dim objWkb As Excel.Workbook
Dim objSht As Excel.Worksheet
Dim rst As Recordset
Dim iRow As Integer
Dim iCol As Integer

Set objXL = CreateObject("Excel.Application")
Set objWkb = objXL.Workbooks.Add

'Create First Worksheet
Set objSht = objWkb.Worksheets("sheet1")
objSht.Name = "All"


Any thoughts appreciated.
 


hi,

Check out the Window object.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi

Thanks, think I've got that sorted.

Next question is how to fix the row height in the resulting spreadsheet because some rows are coming through very tall.
 


you must have WordWrap assigned to the allignment of some column or cell.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
OK thanks, seem to have found a solution that does a row height autofit.

objSht.cells.Rows.Autofit

Thanks for your pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top