CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2013
    Posts
    2

    Exclamation Invalid Procedure Call or Argument

    I have just copied an EXCEL spreadsheet M/S 2007 - from a W7 to a W8 environment and get the error "Invalid Procedure Call or Argument"
    The code that seems to be failing is

    On Error GoTo err
    With ActiveSheet
    .ExportAsFixedFormat _
    Type:=xlTypePDF, _
    Filename:=FileFullPath, _
    Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, _
    OpenAfterPublish:=True


    The code immediately preceeding this is

    Sub Send_Acative_Spreadsheet_as_PDF_via_Gmail()

    ' PART1 - Create a PDF file of the active worksheet

    Dim OlApp As Object
    Dim NewMail As Object
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim FileFullPath As String

    With Application
    .ScreenUpdating = False
    .EnableEvents = False
    End With

    ' Temporary file path where pdf
    ' file will be saved before
    ' sending it in email by attaching it.

    'TempFilePath = Environ$("C:\Invoices") & "\"
    TempFilePath = Environ$("temp") & "\"
    ' Now append a date and time stamp
    ' in your pdf file name. Naming convention
    ' can be changed based on your requirement.

    TempFileName = ActiveSheet.Name & "-" & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" '

    'TempFileName = ActiveSheet.Name & "-" & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf"
    'TempFileName = ActiveSheet.Name & ".pdf"
    'Complete path of the file where it is saved
    FileFullPath = TempFilePath & TempFileName

    'Now Export the Activesshet as PDF with the given File Name and path



    Any ideas please

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Invalid Procedure Call or Argument

    Please use CODE tags when posting code, it makes it much better to read and possibly identify the problem(s)

  3. #3
    Join Date
    Aug 2013
    Posts
    2

    Re: Invalid Procedure Call or Argument

    Sorry this is my first port - how do i use a CODE tag please.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured