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
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