commandchief
Programmer
I had the function below working in AccessXP but it no longer works in Access 2007. I get an error that says it can't create object. Any suggestions??
Function fixXLS(mySheetPath)
Set Xl = CreateObject("Excel.application")
Set Xlbook = GetObject(mySheetPath)
Xl.Visible = xlSheetHidden
Xlbook.Windows(1).Visible = True
Set Xlsheet = Xlbook.Worksheets(1)
Xlsheet.range("a1", "s600").AutoFormat
Xlsheet.range("a1", "s1").Font.Bold = True
Xlsheet.range("a2").Font.Bold = False
Xlsheet.range("a2").Font.Name = arial
Xlsheet.range("a2", "s400").EntireColumn.AutoFit
Xlbook.Save
Xlbook.Close
Xl.Quit
Set Xlbook = Nothing
Set Xlsheet = Nothing
Set Xl = Nothing
End Function
Function fixXLS(mySheetPath)
Set Xl = CreateObject("Excel.application")
Set Xlbook = GetObject(mySheetPath)
Xl.Visible = xlSheetHidden
Xlbook.Windows(1).Visible = True
Set Xlsheet = Xlbook.Worksheets(1)
Xlsheet.range("a1", "s600").AutoFormat
Xlsheet.range("a1", "s1").Font.Bold = True
Xlsheet.range("a2").Font.Bold = False
Xlsheet.range("a2").Font.Name = arial
Xlsheet.range("a2", "s400").EntireColumn.AutoFit
Xlbook.Save
Xlbook.Close
Xl.Quit
Set Xlbook = Nothing
Set Xlsheet = Nothing
Set Xl = Nothing
End Function