Delete ExcelWorksheet from Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to delete an excel document from Access using VBA?

I have an access query sending data to Excel using the TransferSpreadsheet
function. This data is header information for Word mail merge labels.

This all works fine but if a user merges say 3 pages of labels on one
occasion, then ever after that, the word labels document prints out 3 pages
even when there are only a couple of labels to print.

This will happen until the user prints 4 pages and then ever after, 4 pages
will be printed.

If the Excel header docuemnt is deleted between merges then the
TransferSpreadsheet function creates a new one each time and only the actual
number of label pages required will print out.

I need to either delete the excel header document before each
TransferSpreadsheet operation or find a way of letting excel know not to
merge empty cells to Word. (or rather letting word know not to merge empty
excel records.)

Can anyone help me with the code for deleting a document from Access please?

I appreciate your help.

Anna
 
Back
Top