LotusScript - Issue with MS word processing on HCL Domino 11 server - lotus-domino

I am trying to create Word object and open existing word file in web based Domino application. I am able to create the word application and open document when I run the same script in Notes client on Domino server. However I am receiving "Type mismatch" error when I run it through web agent on server.
Version - MS word for MS office 365
HCL Domino server version 11
Following is the Lotusscript code present in the Agent. Agent has "Allow restricted operations with full administrative rights" selected.
Dim offApp as variant
Dim offDoc as variant
Set offApp = CreateObject("Word.Application") --- Word object is created successfully.
Set offDoc = offApp.documents.Open(tempDir & "Test.docx") ---- Error - Type mismatch

Related

SAP Logon 760 via VBA

since the SAP update my vba application fails to connect to the sap system.
My previous code does not work anymore. I guess it is because of the new subfolder. The subfolder "All Urt SAP Systems" and "01 Test System" did not exist in the past.
However this code worked in the past without the new subfolders:
Set rotentry = GetObject("SAPGUI")
Set App = rotentry.GetScriptingEngine
App.Application.DisplayAlerts = False
Set Connection = App.OpenConnection("TE1 (Test - Development System)") '<-- Here comes the error
Set Session = Connection.Children(0)
Does anybody know what I am missing here? I tried a few SAP forums without success.
I am getting the following error message:
SAP Logon connection entry not found

Access 2007 Error 3151 from DAO.OpenRecordSet. How to fix?

Well this is fascinating. I am using MS-Access 2007 to make a from that will allow users to enter data from lab results.
The from utilizes a VBA code call:
DAO.OpenRecordset("{Sql query}" , DB_OPEN_DYNASET, dbSeeChanges)
This call normally works just fine, but I've noticed that when this form is closed and then re-opened, a 3151 ODBC error is generated.
We are using linked tables through Access 2007 for this form, our SQL-Server 2012 version is as follows.
Microsoft SQL Server Management Studio 11.0.2100.60
Microsoft Analysis Services Client Tools 11.0.2100.60
Microsoft Data Access Components (MDAC) 6.1.7601.17514
Microsoft MSXML 3.0 6.0
Microsoft Internet Explorer 8.0.7601.17514
Microsoft .NET Framework 4.0.30319.237
Operating System 6.1.7601
The DAO.OpenRecordset call is utilized in multiple events. Here is the list.
On_Current , _AfterUpdate , Form_Unload
I have found several reported instances of similar errors on Access 2007 with linked tables to SQL-Server, but none seem to have workable solutions for this issue.
As best I can tell, the 3151 doesn't appear to be affecting the form or data in any negative way. I am able to open the form and everything is where it should be as best I can tell. There are about 20 thousand records on this table, so I may be missing something.
Does anyone have any ideas?
9/14 In response to comments I am adding some additional code.
Here is the call on Form_Unload. It contains the failing line.
Private Sub Form_Unload(Cancel As Integer)
Dim ImportID
Dim rst As DAO.Recordset
Dim db As Database
Set db = CurrentDb
Set ImportID = Me.ImportID
#This is the failing line below.
Set rst = db.OpenRecordset("SELECT [dbo_t_inspect].* FROM [dbo_t_inspect] WHERE [dbo_t_inspect].ImportID= " & ImportID & ";", DB_OPEN_DYNASET, dbSeeChanges)
Here is the call from On_Current. This On_Current call is actually made by a sub-form on the main form.
Private Sub Form_Current()
Dim rst As DAO.Recordset
Dim strImportID As String
If IsNull(Me.ImportID) Then
[Forms]![Inspection Receiving]![LabComplete].Visible = False
[Forms]![Inspection Receiving]![LabPending].Visible = True
Else
strImportID = Me.ImportID
Dim db As Database
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT [dbo_t_health].*, [dbo_t_health].ImportID FROM [dbo_t_health] WHERE ((([dbo_t_health].ImportID)=" & Me.ImportID & "));", DB_OPEN_DYNASET, dbSeeChanges)
I am not sure where DAO is defined in this solution. I cannot find it's declaration in my folder titled Microsoft Office Access Class Objects I am open to suggestions on where that might be located.
The precise error message is as follows
Failed to connect to {ODBC Connection Name} Error 3151.
I can then select the debug option and the debugger will take me to the line that tried and failed to connect the the ODBC Connection I am using.
The Error is highly reproducible. All I have to do is enable VBA Macros on the Security Alert and then open the form in question. I close out the form after it loads. Once I attempt to reopen the form, I get the error described above. The Form opens anyway after I click Ok on the error.

VBA Fax using fax server on server from computer on network

I am running Windows Server 2008 R2. I installed the fax server role on the server. I am able to fax documents using the external fax modem attached to the server from computers attached to the network by printing the documents and selecting "Fax on MYSERVER". I am able to fax a .pdf using the following code (which I got from mdsn.microsoft.com) from the server but not from any other computer even when logged into the computer using the administrator account.
Sub fax_report(location_fax_number, report_name, fax_location, fax_file_path)
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim JobID As Object
On Error GoTo Err_Clear
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
'Connect to the fax server
objFaxServer.Connect ("\\MYSERVER")
'Set the fax body
objFaxDocument.Body = fax_file_path
'Name the document
objFaxDocument.DocumentName = report_name
objFaxDocument.Recipients.add (location_fax_number)
JobID = objFaxDocument.ConnectedSubmit(objFaxServer)
objFaxServer.Disconnect
End Sub
The error I'm getting is:
Description: "Operation failed"
HelpContext: 1000440
HelpFile: "C:\Program Files (x86)\Common Files\Microsoft
Shared\VBA\VBA7.1\1033\VbLR6.chm"
LastDllError: 0
Number: -2147023741
Source: "FaxComEx.FaxDocument.1"
Although I am able to fax a .pdf from the server when I try from a computer on the network it fails. I am able to send a .txt file fro a computer on the network. It looks like the .pdf isn't automatically being converted to a .tiff file like it is when I run the code on the server. When I run the code from the server Adobe Acrobat Reader DC opens, the .pdf is opened and converted then faxed without error. Adobe stays open and I can see a temp file was created, it isn't available to be opened from the recent file lists menu.
I figured out the solution. I needed to set Adobe Acrobat Reader DC as the default program to handle .pdfs on the remote computers.

getting error while opening excel workbook in scheduled agent

I got a problem in scheduled agent in lotus script while opening csv workbook.It simply opens workbook from Excel and reads the data.
It works perfectly fine when I run manually. It throws when schedule at workbooks.open line.
Agents Settings : Allow resticted operations with full admin rights.
Code :
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
xlApp.DisplayAlerts = False
Print "New filepath=" & filepath
xlApp.Workbooks.Open filepath ' Open the CSV file
Set xlWorkbook = xlApp.ActiveWorkbook
Set xlSheet = xlWorkbook.ActiveSheet
filepath=C:\Temp\transit_15102008.csv
Error thrown at log.nsf
printing: ERROR : Transfer Files agent- Microsoft Office Excel: Microsoft Office Excel cannot access the file 'C:\Temp\transit_15102008.csv'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook. at line-55
There is only one worksheet in the Excel.
I am not able to figure out the issue. Please somebody help me to resolve. Thanks in advance.
When you run your agent manually, it runs in your workstation context where (I assume) there is MS Office installed.
But when your agent runs as scheduled, it runs in the server context, and if you don't have MS Office installed on the server, or there's no file on the path: C:\Temp\transit_15102008.csv on the server, then your agent fails.
Solution:
Make sure you have MS Office properly installed on the server where your scheduled agent runs.
Make sure that there is file present on the path C:\Temp\transit_15102008.csv on your server where your scheduled agent runs.

Cannot instanciate a NotesUIWorkspace from VBA (Word)

The source situation: I have an Notes Application which uses MS Office 2000 under Windows XP. The new situation has to be MS Office 2010 under Windows 7. IBM Notes is 8.5.3FP3.
The old one uses a VBA template to communicate with Notes which works properly. At one time a Notes.NotesUiWorkSpace object is created to open a document, navigate to a richtext item, select all the content (formatted) and copy to the clipboard. Then the clipboard content ist pasted into the Word document via VBA. That works fine.
The same code in the second environment doesn't work anymore. I noticed that the Notes.NotesUIWorkSpace object cannot be instanciated in VBA. No errors, no hints. Only the runtime error when I reference the workspace-object later.
Here is a code excerpt:
' this is a profile document which is filled correctly
Call prof.Save(True, True)
Call prof.replaceItemValue("Form", "Profile")
' setting up the ui
dim WS as Object
set WS = CreateObject("Notes.NotesUiWorkSpace")
Set uiprof = WS.EditDocument(True, prof)
' Set uiprof = WS.currentDocument
If uiprof.editMode Then Call uiprof.gotofield("RT")
Call uiprof.SelectAll
Call uiprof.Copy
Call uiprof.Close
' later on the clipboard will be pasted into the word document
Any ideas what could be the cause here? I am setting up an environment with XP, MS Office 2010 and Notes tonight to check it out that it is not caused by Windows 7.
If the Windows 7 machine is 64 bit, take a look at the answers here. Note that those refer to the COM classes (lotus.), and you are using the OLE classes (notes.), but I believe the 64/32 bit issue applies to both.