Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 27th, 2004, 01:22 PM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Macro Doesn't Run?

I have written a macro, but it only runs on machines that have VB6 installed on them. Is there a .dll in VB6 that is not available with Excel '97 vba

 
Old December 29th, 2004, 10:08 AM
Authorized User
 
Join Date: Oct 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered
Default

there are a number - presumably you have added a reference to the dll through vba? You might want to check your references to see whats loaded, or reproduce the macro here so that the guilty part of the code can be isolated for you.

 
Old January 4th, 2005, 07:18 PM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

shattered,

Hope you're still interested here's the code

Code:
Private Sub CommandButton1_Click()
ActiveWorkbook.SaveAs FileName:=Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & "-" & Cells(5, 8)
emailRequest
ActiveWorkbook.Close
End Sub

Private Sub CommandButton2_Click()
emailComplete
End Sub


Private Sub CommandButton3_Click()
emailBackOrder
End Sub

Private Sub CommandButton4_Click()
emailOrdered
End Sub

Private Sub Image1_Click()
Static flag1 As Boolean
If Not flag1 Then
    Image1.Picture = LoadPicture("I:\ME\PKGroup\CHECK_MaRK.bmp") 'NOSmile
    flag1 = True
Else
    Image1.Picture = LoadPicture("")
    flag1 = False
End If
Sheets.Select
End Sub

Sub emailRequest()
    Dim RecipArray As Variant
    Dim SubjArray As Variant
    RecipArray = Array(ActiveSheet.ComboBox2.Text, ActiveSheet.ComboBox3.Text)
    SubjArray = "Items To Order: " & Cells(5, 8)
    If Application.MailSystem <> xlNoMailSystem Then
        ActiveWorkbook.SendMail _
            Recipients:=RecipArray, _
            Subject:=SubjArray, _
            returnReceipt:=True
        Application.MailLogoff
    Else
        MsgBox "No mail system installed."
    End If

End Sub
Sub emailOrdered()
    Dim RecipArray As Variant
    Dim SubjArray As Variant
    RecipArray = Array(ActiveSheet.ComboBox3.Text, ActiveSheet.ComboBox4.Text)
    SubjArray = "Items on Order: " & Cells(5, 8)
    If Application.MailSystem <> xlNoMailSystem Then
        ActiveWorkbook.SendMail _
            Recipients:=RecipArray, _
            Subject:=SubjArray, _
            returnReceipt:=False
        Application.MailLogoff
    Else
        MsgBox "No mail system installed."
    End If

End Sub
Sub emailComplete()
    Dim RecipArray As Variant
    Dim SubjArray As Variant
    RecipArray = Array(ActiveSheet.ComboBox3.Text, ActiveSheet.ComboBox4.Text)
    SubjArray = "Order Complete: " & Cells(5, 8)
    If Application.MailSystem <> xlNoMailSystem Then
        ActiveWorkbook.SendMail _
            Recipients:=RecipArray, _
            Subject:=SubjArray, _
            returnReceipt:=False
        Application.MailLogoff
    Else
        MsgBox "No mail system installed."
    End If

End Sub


Sub emailBackOrder()
    Dim RecipArray As Variant
    Dim SubjArray As Variant
    RecipArray = Array(ActiveSheet.ComboBox3.Text, ActiveSheet.ComboBox4.Text)
    SubjArray = "Items on Back Order: " & Cells(5, 8)
    If Application.MailSystem <> xlNoMailSystem Then
        ActiveWorkbook.SendMail _
            Recipients:=RecipArray, _
            Subject:=SubjArray, _
            returnReceipt:=False
        Application.MailLogoff
    Else
        MsgBox "No mail system installed."
    End If

End Sub
 
Old January 5th, 2005, 10:30 AM
Authorized User
 
Join Date: Oct 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered
Default

this may or may not help.. tried your code on a variety of setups and found that it will run without vb6 - if you have office 2003 or office xp installed. I don't have a copy of office 2000 to test it with but I suspect the sendmail is having problems with 97 without the extras that vb6 installs by default for microsoft.

If I can lay my hands on a copy of office 97 I can test this theory further.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to run macro from another workbook? rmilward Excel VBA 2 September 26th, 2009 08:00 PM
How do i run Macro on Web virall23@yahoo.com Excel VBA 2 April 17th, 2008 01:04 AM
Run code in Macro Corey Access VBA 4 February 5th, 2007 10:54 AM
run a macro at a certain date s_gh Excel VBA 4 May 17th, 2006 06:34 AM
run macro from asp aspuser27 Excel VBA 3 January 28th, 2005 04:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.