Weird happenings when connecting to Business Objects

minette

Board Regular
Joined
Jul 8, 2005
Messages
237
Hi all

Wondering if anyone can help me, as I'm stumped.

I have the following code. It works fine from my personal macro folder (PERSONAL.XLS). However, I would like the code to run from a specific file. However, when trying to do that - I get this error:-

Compile Error:
User-defined type not defined

It's exactly the same code - has anyone got any ideas? Please??

Sub GetData1()
Dim BOApp As busobj.Application
Dim Doc As busobj.Document
Dim DataProv As busobj.DataProvider
Dim i As Long, j As Long
Dim strFileName

strFileName = "R:\CONFIDENTIAL\Document3.rep"

Set BOApp = New busobj.Application
BOApp.Visible = False
Call BOApp.LoginAs
Set Doc = BOApp.Documents.Open(strFileName)
Set DataProv = Doc.DataProviders(1)

For i = 1 To DataProv.Columns(1).Count
For j = 1 To DataProv.Columns.Count
ActiveSheet.Cells(i, j) = DataProv.Columns(j).Item(i)
Next j
Next i

BOApp.Quit
Set BOApp = Nothing
MsgBox "done"
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Andrew - that's it!!!!

Thank you very much. I didn't realise I had to set the library in each workbook. I thought as soon as you set it in VBA, it will be there for all workbooks etc.

You are great. Thanks very much!
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

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