B
BFarrell
I am creating Excel reports out of access, and then reformatting the Excel
Files through Automation. This works great and I have had much success.
However, I am trying to set the ShrinkToFit property on 2 columns and it is
not setting this property to true.
The following code correctly sets the WrapText property, but does not set
the ShrinkToFit property.
Set xlObject = CreateObject("excel.application")
Set xlbook = xlObject.Workbooks.Open(path_filename)
xlObject.worksheets(Sheet_Name).Activate
With xlObject
.range("C:C").select
.Selection.wraptext = True
.Selection.ColumnWidth = 22
.range("D").select
.Selection.ShrinkToFit = True
.Selection.ColumnWidth = 25
End With
Any help would be appreciated!
Thanks!
Files through Automation. This works great and I have had much success.
However, I am trying to set the ShrinkToFit property on 2 columns and it is
not setting this property to true.
The following code correctly sets the WrapText property, but does not set
the ShrinkToFit property.
Set xlObject = CreateObject("excel.application")
Set xlbook = xlObject.Workbooks.Open(path_filename)
xlObject.worksheets(Sheet_Name).Activate
With xlObject
.range("C:C").select
.Selection.wraptext = True
.Selection.ColumnWidth = 22
.range("D").select
.Selection.ShrinkToFit = True
.Selection.ColumnWidth = 25
End With
Any help would be appreciated!
Thanks!