Solved

Using Shell Command for Attachments

Posted on 2011-02-14
7
509 Views
Last Modified: 2013-12-18
I have a requirement that I have to give a link to show attachment, which should not be in edit mode(so that nothing can be saved by editing it). It is workflow application. I am using sheel command to perform that action, the issue is that One user is not able to open the attachment. she ia not getting any error but the attachment is not opening when the hot spot to view attachment is clicked. Pleas find the below code which I have written on the hot spot.


Sub Click(Source As Button)
      Dim ss As New notessession
      Dim doc As NotesDocument
      Dim rtitem As Variant
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim fnm As String
      
      Set uidoc=ws.CurrentDocument
      Set doc=uidoc.Document
      Set rtitem = doc.GetFirstItem( "AttPriceAttachment" )
      If ( rtitem.Type = RICHTEXT ) Then
                                   Forall o In rtitem.EmbeddedObjects
            If ( o.Type = EMBED_ATTACHMENT ) Then
            fnm= "c:\" & o.Source
            Call o.ExtractFile(fnm)
            Dim result As Integer
            'result = Shell(fnm, 3)
            'cmd = {cmd /C "\Backlog.txt"}
            cmd = {cmd /C "\}& o.Source &{"}
            ret = Shell( cmd )
                        
                  End If
            End Forall
      End If
End Sub
0
Comment
Question by:Glactus
  • 3
  • 3
7 Comments
 

Author Comment

by:Glactus
ID: 34886695
The problem exists only for one user, every other are able to see it.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34886850
Have you tried to debug the code? Just turn debugger on and click on the hot-spot.
0
 

Author Comment

by:Glactus
ID: 34886920
Yes I have done through the debugger and it is running properly and it is returning the excel path in the variables, but it is not displaying the excel and not giving any error also
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Accepted Solution

by:
mbonaci earned 250 total points
ID: 34886929
If you want to improve your code look at the solution in this thread to learn how to use WinAPI function ShellExecuteEx:

http://www.experts-exchange.com/Q_26718234.html#34629225

Beware that the code prints the attachment, not just opens it...

See here to learn about function parameters:
    http://msdn.microsoft.com/en-us/library/aa932861.aspx
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34886937
See, in the task manager, whether the Excel task was left there hanging.
If not see whether her Excel is working properly (launch the detached file manually).
0
 

Author Comment

by:Glactus
ID: 34894308
Thanks for the help, the code helped, I am doing final round of testing,  I will let you know when finished.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 34902702
First thing to do is check that the file is actually there. Second thing to do is check if you can run the equivalent command manually, successfully, from a command prompt. If the file is there, and you can run the ocmmand succesffully from a prompt, then it is a Notes problem. If the file is not there, it is probably a coding problem. If the file is there, but you fial when running it manully, then it is a problem with the workstation and.or the installation of Excel on the workstation.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mobile Iron iphone stop receiving new mails 6 1,227
External emails not coming through 3 101
Disable Return Receipt In Lotus Notes 15 181
Migration Lotus to Exchange 2016 4 151
This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now