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!

formatting excel within access

Status
Not open for further replies.

Wrathchild

Technical User
Aug 24, 2001
303
US
Using Office XP I have the module:

Function FormatExcel()
Dim ExcelApp As Object
Dim myPath
myPath = "\\dir\Refund.xls"
Set ExcelApp = GetObject(myPath, "Excel.Sheet").ActiveSheet
ExcelApp.ActiveSheet.Cells.Select
ExcelApp.ActiveSheet.Cells.EntireColumn.AutoFit
ExcelApp.Save
ExcelApp.Close
End Function

I would like to open the Excel sheet, select everything and autofit all the columns, save it then close it. I got the code from a posting for Excel 97 so I'm sure it's something to do with that as to why it's not working. It does open the spreadsheet then errors on the selecting cells line. Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top