Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing a custom bar when sending a mail

Status
Not open for further replies.

Navvy

Technical User
Apr 12, 2002
64
US
Good Morning All,
I am trying to send a mail via the following code:
Sub sendMail()

Dim sj As String

sj = "Today"

ActiveWorkbook.sendMail Recipients:="Nav, Ben", Subject:=sj

End Sub

I have tried:
Application.CommandBars("Custom 1").Visible = False

But that doesn't work.
 
What doesn't work? It won't send mail? It won't hide the bar? How are the two related?
Rob
[flowerface]
 
Hello Rob, it can send the mail but I can't get rid of the custom bar when it sends the mail to other people. So I want it to hide the bar when it sends it out. Thank you.
 
You mean when the recipient opens the workbook, (s)he sees the custom bar, and you want to avoid that? I don't understand why they would have the custom bar at all, unless it is programmatically generated in your VBA project. Commandbars is an application object, not a workbook object.
Rob
[flowerface]
 
Ok, i see what happens,
Private Sub Workbook_Open()

AddCustomBar bReload:=True

End Sub


I need the bar to come up for me but not others when i send the mail
 
You could simply do

Private Sub Workbook_Open()
if application.username="Navvy" then AddCustomBar bReload:=True
End Sub

(fill in your real username, of course)
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top