Page 1 of 1

error excel from vba

Posted: Tue Nov 05, 2013 4:37 pm
by janpranot
อาจารย์ครับ

รบกวนสอบถามหน่อย ครับ ผมทำการ code vba แล้วได้ไฟล์มาใหม่ แต่มีปัญหาคือว่าเวลาเปิดไฟล์ที่ได้มาจาก vba excel จะมีข้อความดังนี้ครับ


"The file you are trying to open "test.xls" in a different format than specified file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"


เพราะเวลาจะเอาไฟล์นี้ไปใช้ต้องทำการ save as ใหม่บน excel อีกครั้ง

ไม่ทราบว่าเกิดจากอะไรและจะสามารถทำการแก้ไขได้ยังไงครับ :flw:

ขอบคุณครับ

Re: error excel from vba

Posted: Tue Nov 05, 2013 5:33 pm
by snasui
:D กระทู้นี้ได้คำตอบแล้วยังครับ http://www.snasui.com/viewtopic.php?f=3&t=5669

Re: error excel from vba

Posted: Wed Nov 06, 2013 9:13 am
by janpranot
viewtopic.php?f=3&t=5669
กระทู้นี้ ได้ทำการแก้ไขเรียบร้อยตามที่แนะนำมาแล้วครับ
ขอโทษทีครับนึกว่าตอบกระทู้ไปแล้ว ขอบคุณครับอาจารย์

"The file you are trying to open "test.xls" in a different format than specified file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"


ส่วน error นี้ตอนนี้ก็ใช้วิธี save as อยู่ครับ
ยังหาวิธีแก้ไม่เจอเลยครับ :flw:

Re: error excel from vba

Posted: Wed Nov 06, 2013 4:04 pm
by janpranot
อาจารย์ครับ

กรณีนี้แก้ได้แล้วครับ โดยการใส่ FileFormat:=56 ตอนทำการ save as file ครับ :D