Forum Home
Press F1
 
Thread ID: 22447 2002-07-21 22:22:00 Excel2000 - clearing clipbard & application quit parry (27) Press F1
Post ID Timestamp Content User
64081 2002-07-21 22:22:00 Hi, I am running a routine to import a text file in Access. As Access macros dont appear to have the ability to import text files starting from a particular row (to wipe out the header), I am importing the text file into Excel first, formatting as required then importing into Access. This is done by a macro in Access which in turn opens Excel (that has an Auto_Open macro) then imports the data into Access from the saved workbook.

I am having two problems with Excel that someone may be able to help with.
1) I am copying a large amount of data in Excel so when I close the Workbook I am getting the message that "there is a large amount of data on the clipbard ..."
I cant find anything to clear this. I am using the code
"ActiveWindow.Close (False)" to close the workbook. I would like to clear the clipboard but I dont know how. I would settle for a way of disabling the message. Using Sendkeys to close the dialog doesnt work.

2) When the workbook closes I then want to quit Excel. I am using the code "application.quit" but Excel is not quitting and I don't know why.

cheers
Parry
parry (27)
64082 2002-07-21 22:42:00 1. Sub
On Error GoTo ????
Exit Sub: ????
End Sub

2. Application.Close (Not 100% sure about this one)

Capt Jimbo
Capt Jimbo (17)
64083 2002-07-21 22:53:00 Sorry

Thinking properly this time
(It is still early after all) :-)

Try

Sub test()
Application.DisplayAlerts = False
Application.Quit
End Sub

Capt Jimbo
Capt Jimbo (17)
64084 2002-07-21 23:12:00 What version of Access are you using? As far as I can recall, they have all had the ability to strip the first row (headers) from an imported text file. wuppo (41)
64085 2002-07-22 00:06:00 To clear the clipboard after the data has been copied use the statement
Application.CutCopyMode = False

Don't know about closing Excel from within an Excel VBA routine.
Russell D (18)
64086 2002-07-22 00:15:00 Hi, thanks the displayalerts code works a treat - no more clipboard confirmation.

I think I figured out what was wrong with the Application.quit line. It appears its because before this line I have closed the workbook which contains the code, so instead of closing it with the save option, I have just saved the workbook the run Application.Quit and it's all sweet.

Thanks everybody for your help.

cheers
Parry.
parry (27)
1