Code problem

jamesd

Board Regular
Joined
Sep 22, 2003
Messages
220
I have a simple bit of code that calls my BO aplication.
This works fine in one database but if i copy the same into a new database it does not work. - error message - Compile error user defined type not defined and the first line of code is highligted on debug??( BOApp As busobj.Application)
Any ideas.

Option Compare Database
Option Explicit


Sub GetadjustmentData()
Dim BOApp As busobj.Application
Dim Doc As busobj.Document
Dim Rpt As busobj.Report
Set BOApp = New busobj.Application
BOApp.Visible = True
Call BOApp.LoginAs("toddj01", "toddj01", False)
Set Doc = BOApp.Documents.Open("S:\Jim Todd\Sched Data Collection\ProductData.rep")
Doc.Variables("date").Value = Format(Date - 92, "dd/mm/yyyy")
BOApp.Interactive = False
Doc.Refresh
BOApp.Interactive = True
For Each Rpt In Doc.Reports
Call Rpt.ExportAsText(Doc.Path & "\" & Rpt.name)
Next Rpt
BOApp.Quit
Set BOApp = Nothing
On Error GoTo 0
Exit Sub
err:
MsgBox "917 update failed"
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
You have to set the Reference to use the Application in the VBA screen so in the VBA screen select the Tools Menu and References and then search for the application then tick the box by its name and save and close then it should work for you.
 
Upvote 0
Happy to help and thanks for letting me know you have a working solution.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,607
Members
449,037
Latest member
Arbind kumar

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