expected format

M

Martin

Hello,

I have this code which worked a treat but all of a sudden I get the
following message:

Runtime Error 3274. External table is not in the expected format.

Does anyone have an idea what has gone wrong? It worked just yesterday and
no changes have been made. Ive been trying to figure it out all day but I
cant get anywhere with this.

Thanks in advance for any help anyone can give me.

Martin



Private Sub ProducePack_Click()

Dim vItem
Dim SourceFile, DestinationFile
Dim XL As Object
Dim db As Database
Dim rs As Recordset

DoCmd.SetWarnings False

Call CurrentDBDir

DestinationFile = CurrentDBDir & "DBCB Pack.xls"


ubADName = Null
ubADEmailaddress = Null
intProgress = 0

For Each vItem In Me.DBCBName.ItemsSelected
ubDBCBName = Me.DBCBName.ItemData(vItem)

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Qry Basic
Information", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tbl
Totals", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tbl Totals
2", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 01
01", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
01", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
01 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
02", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
02 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
03 Export", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
03 Export Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
04", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
04 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
06", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 02
06 BL Export", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 03
01", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 03
01 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 03
02 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
01", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
01 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
02", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
02 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
03", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
03 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
04 Export", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
05", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
05 Comm", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
05 2", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report 04
05 Comm 2", DestinationFile, True



SourceFile = CurrentDBDir & "DBCB Pack.xls"
DestinationFile = "c:\temp\" & Me.ubDBCBName & ".xls"
FileCopy SourceFile, DestinationFile


Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open DestinationFile
XL.Run "Format" ' Excel macro name
XL.Workbooks.Close
Set XL = Nothing

Me.intProgress = Me.intProgress + 1
Me.Repaint

Next

DoCmd.SetWarnings True

Call Shell("C:\WINDOWS\EXPLORER.EXE ""c:\Temp""", 4)
End Sub
 
A

Aashish

Open the query you are trying to export.. i guess its empty and vba does give
error while exporting the empty workbooks.

lemme know if you reach a solution.. i am stuck at that point.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top