+ Reply to Thread
Results 1 to 20 of 20

Excel Compatibilty issue with file conversion

  1. #1
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Excel Compatibilty issue with file conversion

    Hi Guy's I'm having an issue in where I have developed a Macro which on the event of a button press which will generate an email and convert the Spreadsheet which was being worked on into a csv file.

    Now, this works great in Excel 2007, I press the button and I receive the email and in the attachment is a csv file which I open and everything works great. Now when I have tested this on an Excel 2003 machine. The email comes through fine and the attachment is a csv one, but when I come to open it, I get the message, 'The file you are trying to open, '12345654321.csv', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening file. Do you want to open the file now?'

    On clicking yes, it opens the spreadsheet in an excel format???????

    Here is my code, any help would be much appreciated.

    Please Login or Register  to view this content.
    Thank You

    Jonah
    Last edited by Jonah; 01-18-2010 at 06:59 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    hi Jonah
    you cant just change the file extenion to csv Its still a xls workbook. it just displays the csv icon
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    my bad in 2007 its .xlCSV extension

  4. #4
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Quote Originally Posted by pike View Post
    my bad in 2007 its .xlCSV extension
    Hi Pike, why does this work in Excel 2007 but not in Excel 2003 then. It converts the file to a csv format in 2007

    Kind Regards,

    Jonathan

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    try for 2003
    Please Login or Register  to view this content.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    my only other thoughts are that 2007 will open the xlms as a xlcvs
    but 2003 wont so are you sending the correct workbook?
    Please Login or Register  to view this content.
    Last edited by pike; 01-15-2010 at 07:20 AM.

  7. #7
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Quote Originally Posted by pike View Post
    try for 2003
    Please Login or Register  to view this content.
    Where would I place this in my code?

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    try..
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Quote Originally Posted by pike View Post
    my only other thoughts are that 2007 will open the xlms as a xlcvs
    but 2003 wont so are you sending the correct workbook?
    Please Login or Register  to view this content.
    The workbook is the one in where the code lies. I'm not picking up the workbook from anywhere. I'm converting the same workbook through this script and then emailing it as a csv file.

  10. #10
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Quote Originally Posted by pike View Post
    try..
    Please Login or Register  to view this content.
    I get a 'Type mismatch error'

    Jonah

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    then
    Please Login or Register  to view this content.
    also try closeing the workbook before attaching it

  12. #12
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Quote Originally Posted by pike View Post
    then
    Please Login or Register  to view this content.
    also try closeing the workbook before attaching it
    Hi Pike, still the same error...

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    Try closing the saveas work book before attaching it
    and .Close savechanges:=False to true

  14. #14
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Quote Originally Posted by pike View Post
    Try closing the saveas work book before attaching it
    and .Close savechanges:=False to true
    Still not working Pike. It works in 2007, but I get the same error message in 2003 when I click the button. Type Mismatch

    I think I've closed the saveas work book by attaching it. and .Close savechanges:=True.

    I've put this sub in my workbook. The rest of my code is in the module.

    Regards,

    Jon

  15. #15
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    Hey Jonah
    Someone, if they have a definitive answer, will reply
    it cant be much

  16. #16
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Quote Originally Posted by pike View Post
    Hey Jonah
    Someone, if they have a definitive answer, will reply
    it cant be much
    Thanks for trying to help Pike, I really appreciate it. Anyone else have any ideas?

    Jonah

  17. #17
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Hey Guys, can anyone help me with this problem. Thank You,

    Jonah

  18. #18
    Registered User
    Join Date
    12-20-2009
    Location
    Worcester
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Excel Compatibilty issue with file conversion

    Thanks for all the help on this. My problem was a mistake in the code.

    FileExtStr = ".csv": FileFormatNum = -4143

    Is in 2003 also a 6

    FileExtStr = ".csv": FileFormatNum = 6

    Thanks Ron de Bruin for this. Thank you to all who tried to help also. Much appreciated.

    Jonah

  19. #19
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    arr.. good work

  20. #20
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Excel Compatibilty issue with file conversion

    and special thank you for marking posts solved with the answer
    If I had and reps left they would be yours

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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