Solved

Using Shell Command for Attachments

Posted on 2011-02-14
7
510 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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