?
Solved

Using Shell Command for Attachments

Posted on 2011-02-14
7
Medium Priority
?
517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
mbonaci earned 1000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 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