aarondewberry
IS-IT--Management
All I am trying to use VB in excel to open, refresh and export data from a BO 5.1.9 report.
I am using code from the following thread thread393-379294
The problem comes with the Buso.Documents.Open part of the code. It keeps coming up with an error message "You are not authorised to use this document". I have a password and username for BO 5.1.9, is this what is affecting the code? If so, how do we get around it?
Code
Dim Buso As busobj.Application
Dim DP As busobj.DataProvider
Dim HT As busobj.Report
Dim HP As busobj.Document
Dim I As Integer
Application.Interactive = False
Application.DisplayAlerts = False
Set Buso = CreateObject("BusinessObjects.Application")
Buso.Interactive = True
Buso.Visible = True
AppActivate "BusinessObjects"
Buso.Documents.Open ("C:\test\sking05.rep")
Buso.ActiveDocument.Refresh
Set HT = ActiveDocument.Reports.Item(1)
Call HT.ExportAsText("C:\test\results\text\sking05.txt")
Buso.ActiveDocument.Save
Buso.ActiveDocument.Close
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
' the BOMO085_INV1 report
Workbooks.OpenText Filename:="C:\test\results\text\sking05.txt" _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1)
Application.Interactive = True
ActiveWorkbook.SaveAs Filename:= _
"C:\test\results\excel files\report_INV1.xls", FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
I am using code from the following thread thread393-379294
The problem comes with the Buso.Documents.Open part of the code. It keeps coming up with an error message "You are not authorised to use this document". I have a password and username for BO 5.1.9, is this what is affecting the code? If so, how do we get around it?
Code
Dim Buso As busobj.Application
Dim DP As busobj.DataProvider
Dim HT As busobj.Report
Dim HP As busobj.Document
Dim I As Integer
Application.Interactive = False
Application.DisplayAlerts = False
Set Buso = CreateObject("BusinessObjects.Application")
Buso.Interactive = True
Buso.Visible = True
AppActivate "BusinessObjects"
Buso.Documents.Open ("C:\test\sking05.rep")
Buso.ActiveDocument.Refresh
Set HT = ActiveDocument.Reports.Item(1)
Call HT.ExportAsText("C:\test\results\text\sking05.txt")
Buso.ActiveDocument.Save
Buso.ActiveDocument.Close
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
' the BOMO085_INV1 report
Workbooks.OpenText Filename:="C:\test\results\text\sking05.txt" _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier _
:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1)
Application.Interactive = True
ActiveWorkbook.SaveAs Filename:= _
"C:\test\results\excel files\report_INV1.xls", FileFormat:=xlExcel9795, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close