กระทู้เก่าบอร์ด อ.Yeadram
938 1
URL.หัวข้อ /
URL
Run-time error 429
เดิมที่ เขียนโปรแกรมกับเครื่องที่ เป็น micro soft office ที่มีการทำงานกับ excel
แต่ได้ย้ายไฟล์โปรแกรมมาทำงานอีกเครื่อง ซึ่งมี แค่ opensoft office 4.1.2 ต้องเปิดกับ openOffice calc โดยใช้โค้การเปิดเหมือนเดิม แต่เปิดไม่ได้ อยากทราบว่าผมต้องเปลี่ยนโค้ดอะไรบ้าง ถึงจะเปิดไฟล์ excel ได้ครับ
โค้ดเดิม
Private Sub cmdFeederfd1_Click()
Dim appexcel As Object
Set appexcel = CreateObject("Excel.application")
appexcel.workbooks.Open "C:\FEEDER1\FEEDER.csv"
appexcel.Visible = True
End Sub
แต่ได้ย้ายไฟล์โปรแกรมมาทำงานอีกเครื่อง ซึ่งมี แค่ opensoft office 4.1.2 ต้องเปิดกับ openOffice calc โดยใช้โค้การเปิดเหมือนเดิม แต่เปิดไม่ได้ อยากทราบว่าผมต้องเปลี่ยนโค้ดอะไรบ้าง ถึงจะเปิดไฟล์ excel ได้ครับ
โค้ดเดิม
Private Sub cmdFeederfd1_Click()
Dim appexcel As Object
Set appexcel = CreateObject("Excel.application")
appexcel.workbooks.Open "C:\FEEDER1\FEEDER.csv"
appexcel.Visible = True
End Sub
1 Reply in this Topic. Dispaly 1 pages and you are on page number 1
Time: 0.3088s
Private Sub cmdFeederfd1_Click()
Dim oSM, oDesk, oDoc As Object 'OOo objects
Dim OpenParam(1) As Object 'Parameters to open the doc
Dim SaveParam(1) As Object 'Parameters to save the doc
Set oSM = CreateObject("com.sun.star.ServiceManager")
Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
Set oDoc = oDesk.loadComponentFromURL("file:///C:/FEEDER1/FEEDER.csv", "_blank", 0, OpenParam())
Set oDesk = Nothing
Set oSM = Nothing
End Sub