Excel library reference

Corticus

Well-known Member
Joined
Apr 30, 2002
Messages
1,579
Hi all,

I need to do this:
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")

With ExcelSheet.Sheets(1).Columns("A:A")
.ColumnWidth = 15
' .HorizontalAlignment = xlRight
End With


I commented out the xlright line, becaue Access can't find it.

How do I add the excel library to access?

Its like this, but for Access I think...

Sub MakeLibrary_Word()

On Error Resume Next

ThisWorkbook.VBProject.References.AddFromGuid _
"{00020905-0000-0000-C000-000000000046}", 8, 0

End Sub


Thank all,
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hello mate,

I ran this code to get a GUID for Excel (I had Excel referenced at the time)

Code:
Sub GetGIUD()
For Each i In ActiveWorkbook.VBProject.References
    Debug.Print i.Description & vbTab & i.GUID & "Major=" & i.major & ", Minor=" & i.minor
Next
End Sub

From the code above, I got this to work in Access:-

Code:
Sub Test()
'Add reference to Excel library
Application.References.AddFromGuid "{00020813-0000-0000-C000-000000000046}", 1, 3
End Sub
 
Upvote 0
Yeah!

Thanks dk, that's exactly what I wanted. I tried and tried to figure it out but it's one of those things that's not all that intuitive.

Take care,
 
Upvote 0

Forum statistics

Threads
1,221,501
Messages
6,160,175
Members
451,629
Latest member
MNexcelguy19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top