Solved

Using Shell Command for Attachments

Posted on 2011-02-14
7
508 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

746 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

12 Experts available now in Live!

Get 1:1 Help Now