+ Reply to Thread
Results 1 to 1 of 1

I get a 400 error or 1004 error depending on where I run the code

  1. #1
    Registered User
    Join Date
    04-03-2012
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    7

    Question I get a 400 error or 1004 error depending on where I run the code

    Hello, I am trying to get code for a spreadsheet to work. The code was working yesterday and now it does not! I checked the version of spreadsheet that I gave to a coworker to beta test and it still works for him, so I'm stumped. Any help would be greatly appreciated.

    Here is the code below. It is based (heavily) on Ron de Bruin's code. Please forgive some of the comments, I do that to hang onto code I might still need later on.

    Sub Email_link()
    'Working in Office 2000-2010
    Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String

    thisfile = "RFQ for " & Range("h13").Value & " for " & Range("g11").Value _
    & " " & Format(Now, "dd-mmm-yy")

    'filepath = "o:\Quotes Folder\test run for new form\"

    '"o:\Quotes Folder\" & Range("g11").Value & "\" & "RFQ for " & Range("h13").Value & " for " & Range("g11").Value _
    & " " & Format(Now, "dd-mmm-yy") & ".xls"
    '"t:\documents\my media\" & Range("g11").Value & "\" & "test" & Format(Now, hh - mm - ss)
    '"RFQ for " & Range("h13").Value & " for " & Range("g11").Value _
    & " " & Format(Now, "dd-mmm-yy hh-mm-ss")
    'filepath = "\\aero-pdc\public\estimating\bids\test folder\"

    'Application.Dialogs(xlDialogSaveAs).Show thisfile

    ActiveWorkbook.SaveAs filename:="o:\Quotes Folder\test run for new form\" & thisfile & ".xls"

    If ActiveWorkbook.Path <> "" Then
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    strbody = "Please respond at your earliest convienence with your best pricing and delivery." _
    & "<br><br>Best regards,<br>" & Range("g6").Value


    On Error Resume Next
    With OutMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = ActiveWorkbook.Name
    .HTMLBody = strbody
    .Attachments.Add ActiveWorkbook.FullName
    .Display 'or use .Send'
    End With
    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing
    Else
    MsgBox "The Activesheet does not have a path, Save the file first."
    End If
    End Sub
    Many thanks,
    Matt
    Last edited by mouseman; 08-30-2013 at 10:49 AM. Reason: Did not realize that the PHP tags would remove the "\"'s

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Getting Error 1004 Object or Application Defined Error - Code to rearrange data
    By BlazzedTroll in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-10-2013, 12:10 PM
  2. [SOLVED] Runtime-error '1004' cannot access the file, depending on the computer
    By yuichi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2012, 06:05 PM
  3. [SOLVED] Range error in code, runs alone but not inside my full program, giving runtime error 1004
    By charizzardd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2012, 03:34 PM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. Error 1004 depending on OS?
    By sui in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-19-2005, 06:28 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1