Problem automating "Tools, Send" command 
Author Message
 Problem automating "Tools, Send" command

I have a simple sub routine that attempts to execute the
send command (need to send msg in outbox).  On my test
machines this works corectly but on a remote PC (which I
can't debug) this bombs out when "objCtl.Execute" is
called.  

I need to set the ActiveExplorer menu bar with a default
folder of olFolderInbox because I don't know what view
Outlook may be in, e.g. the tasks could be displayed and
therefore the Menu Bar does not contain the Tools, Send
command.  I don't want to use Send & Receive because the
user may not be logged on.

What could be wrong with my code or how can I reliably
execute the send command?

Thanks for any input,

James

Sub SendNow()
    Dim olApp As Outlook.Application
    Dim objName As NameSpace
    Dim objCtl As Office.CommandBarControl
    Dim objPop As Office.CommandBarPopup
    Dim objCB As Office.CommandBar

    Set olApp = Application
    Set objName = olApp.GetNamespace("MAPI")
    Set myOlExp = olApp.ActiveExplorer
    Set myfolder = objName.GetDefaultFolder(olFolderInbox)
    Set myexplorer = myfolder.GetExplorer

    myexplorer.Display

    Set objCB = olApp.ActiveExplorer.CommandBars("Menu
Bar")
    Set objPop = objCB.Controls("Tools")
    Set objCtl = objPop.Controls("Send")

    objCtl.Execute
    myexplorer.Close

    Set olApp = Nothing
    Set objName = Nothing
    Set myOlExp = Nothing
    Set myfolder = Nothing
    Set myexplorer = Nothing
    Set ojbcb = Nothing
    Set objPop = Nothing
    Set objCtl = Nothing
End Sub



Sun, 21 Aug 2005 01:02:26 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Sending automated mails as "text only"

2. Automating "Have Replies Sent to"

3. How To Send A "Restart" Command

4. API to execute "net send" command

5. Problem With "window.showmodaldialog("")"

6. Acc97: Problems using "Command" variable

7. Having problems with "Insert Into" command

8. Synchronized problem about "SHELL command"

9. Problem about "Write" command

10. Send without putting in "Sent"?

11. automating "Move to Folder..." using VBscript

12. Automating "Save Calendar As Web Page"

 

 
Powered by phpBB® Forum Software