B
Bud Dean
Here's the issue:
We multiple versions office, mixed versions of office. We have everything
from 97 to 2003. Some machines with one version of office and a different
version of Access. Many of the Access Db's we do genereally have to import
data or export data to
excel or both.
I have been successful with everything so far. I have run into a couple
issues I can't seem to figure out.
The following code does the following:
Deletes the las column
Highlights column headings (row1)
Adds totals
I have looked in all my old books, searched google, msdnfor the better part
of yesterday into this morning...I just can't seem to figure out how to make
this wok using late binding...sure would appreciate any help and guidance...
*************Code start***************
Sub DelXLIDColumn(BookName As String, shtname As String)
Dim objXL As Object
Dim strWhat As String, boolXL As Boolean
Dim objActiveWkb As Object
Dim objSHT As Object
DoCmd.Hourglass True
If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If
objXL.Application.workbooks.Open (BookName)
Set objActiveWkb = objXL.Application.ActiveWorkBook
'objXL.Visible = True
'Set objSHT = objSHT.Worksheets(1)
With objActiveWkb
With objActiveWkb.Worksheets(1)
.Range("A1").Select
Selection.End(xlToRight).Select
Selection.EntireColumn.Delete
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(9,
10, 11), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=False
.Name = shtname
.Columns("A:AA").EntireColumn.AutoFit
.Range("A1:AA1").Select
Selection.Font.Bold = True
.Range("A1").Select
End With
End With
objActiveWkb.Close savechanges:=True
If boolXL Then objXL.Application.Quit
Set objActiveWkb = Nothing: Set objXL = Nothing
DoCmd.Hourglass False
End Sub
**************************End Code *******************
Thanks in advance,
Bud Dean
We multiple versions office, mixed versions of office. We have everything
from 97 to 2003. Some machines with one version of office and a different
version of Access. Many of the Access Db's we do genereally have to import
data or export data to
excel or both.
I have been successful with everything so far. I have run into a couple
issues I can't seem to figure out.
The following code does the following:
Deletes the las column
Highlights column headings (row1)
Adds totals
I have looked in all my old books, searched google, msdnfor the better part
of yesterday into this morning...I just can't seem to figure out how to make
this wok using late binding...sure would appreciate any help and guidance...
*************Code start***************
Sub DelXLIDColumn(BookName As String, shtname As String)
Dim objXL As Object
Dim strWhat As String, boolXL As Boolean
Dim objActiveWkb As Object
Dim objSHT As Object
DoCmd.Hourglass True
If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If
objXL.Application.workbooks.Open (BookName)
Set objActiveWkb = objXL.Application.ActiveWorkBook
'objXL.Visible = True
'Set objSHT = objSHT.Worksheets(1)
With objActiveWkb
With objActiveWkb.Worksheets(1)
.Range("A1").Select
Selection.End(xlToRight).Select
Selection.EntireColumn.Delete
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(9,
10, 11), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=False
.Name = shtname
.Columns("A:AA").EntireColumn.AutoFit
.Range("A1:AA1").Select
Selection.Font.Bold = True
.Range("A1").Select
End With
End With
objActiveWkb.Close savechanges:=True
If boolXL Then objXL.Application.Quit
Set objActiveWkb = Nothing: Set objXL = Nothing
DoCmd.Hourglass False
End Sub
**************************End Code *******************
Thanks in advance,
Bud Dean