Update Excel Before Quit....
Hi
I'm trying to create a commandbutton that will update a Microsoft query in excel.
My problem is that excel is quitting before the workbook is updated. Maybe I need a "wait" command or something...
This is what i have:
Private Sub cmdASP_Click()
Dim XL
Dim XLARK
Set XL = CreateObject("excel.application")
Set XLARK = GetObject("c: est.xls")
XL.Visible = True
XLARK.Parent.Windows(1).Visible = True
XLARK.Activate
XLARK.RefreshAll
XLARK.Application.Cells(1, 1).Value = Now()
XL.ActiveWorkbook.Close Savechanges:=True
XL.Quit
Set XL = Nothing
Set XLARK = Nothing
End Sub
Can anyone help me out?
eroness
View Complete Forum Thread with Replies
Related Forum Messages:
Access Won't Quit
Hello again folks. Having spent a week building my database and everything is working as expected - I set the 'startup' properties and now Access won't save or quit from the main form. In order to close I have to select 'form design' and then the 'X' will work. This goes for all the methods of closure including the menu and system buttons. I cannot access the cnt/Alt/Del with this system but that's immeterial. I'm using XP and Access 2000. I have tried removing all the conditionally formatted controls. Help please!! Chalkie.
View Replies !
Queries That Won’t Quit
Sorry to bug you guys (or Gals) for something as simple as this. I have several subforms and list boxes that references other subforms using queries and when I close the form using DoCmd.Close Some of the queries ask for parameter values. Is there a little snippet that will fix this? Thanks Everyone,
View Replies !
Employee Quit?
I have a form which has a drop down box which links to a table with Employee names. One employee quit and I want to delete her name from the table. But... if I do that, I will delete her entirely from all previous records. Is there a way to keep all previous records, but take her out of the drop down choices?
View Replies !
My Code To Quit The Application Has A Bug!
Hi I have succsefully used the code suggested on theis excellent forum to boot user from the db to repair it. It is FE/BE set up and the ONTIMER on the login form is used to chuck people off over the network. My ug is: I like to give people the waring before I chuck them off, but sometimes when they are using another application with the db running in the background they dont get the message, therefore dont click ok so my Code wont carry on and Quit application when I want it to. The code is trapped in MsgBox "Please finish what your doin, as the db will shut down", vbinformation Is there any way I can make my code bypass this if they user hasnt clicked ok? Many thanks in advance
View Replies !
Quit() Won't Work When User Has Certain Windows Open
I'm working on a program that Windows runs as a scheduled program at 5PM every day that closes MS Access so folks can go in do updates on databases. I've managed to get the program to exit- when there aren't any complicated windows open- using the following command: App1.Quit(Access.AcQuitOption.acQuitSaveNone); The problem is that when the user leaves the "New" window open (the window that comes up when you click File:New) or the "Open" window open, Access can't shut down. My thinking is that if I can just have the program close these windows, Access can shut down. So, any suggestions? Thanks for your help.
View Replies !
Import/Update Table From Excel ?
Hi all, I use an Excel import to update tabel 'deelnemer'. This works oke BUT when user 'x' has a linked field in tabel 'B' the import fails due to RI (I think..) How can I make it so in this code that the user record is updated and can I restore the RI (otherwise my forms won't work..) This is the code I use for importing the Excel file: DoCmd.CopyObject , "Deelnemer_copy", acTable, "Deelnemer" DoCmd.SetWarnings False DoCmd.RunSQL "Delete * from deelnemer" DoCmd.SetWarnings True ImportFile = Application.CurrentProject.Path & "Deelnemer.xls" DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel3, "Deelnemer", ImportFile, True Please help me on this, breaking my head over it and I'm newbie on all this.. Thanks in advance !
View Replies !
Import From Excel And Update And Append To Many Records
Hi there I have a spreadsheet that I have successfuly imported into Access but now I would like to maintain it, update/append/delete records etc. The spreadsheet is produced weekly and Intend to import it into my Access database on a weekly basis there are around 20,500 records and 15 Fields. I have kept the Field names in Access the same as the spreadsheet, except that the Access table has an ID field with PK and autonum. There are no other tables involved, it should just be a straight import update append ...but how? I am looking for the best way to approach carryingout a regular update, is it best to bring the new import into a Temp table? and then carry out the analysis of what has been changed, deleted or added? Also the queries to do this, how exactly do you get a query to scan through all of these rows and columns. one last thing is it possible to create a table during the update/append process that will log all of the changes or flag the records using A=Append, D=Deleted U=Updated... I've tried looking at various forums but mostly all I find is people with similar problems and no definitinve answer. thanks Batwings:D
View Replies !
Export To Excel, Update Two Fields In A Query Question
We have a report that is generated monthly to management on Excel. We Export the data from an Access query to Excel and at that time the user has to update the Month Reported and Year Reported fields on each record within that query. Can I set up something to where the user can click a button or something and Access do all of this automatically? Example: May 2005 was just sent out and we exported the data from the query to Excel and went back into the query and chose update query and had Access fill in May (in the month reported field) and 2005 (in the year reported field) on all of the records. Any help is appreciated, thanks...
View Replies !
Export To Excel, Update Two Fields In A Query Question
We have a report that is generated monthly to management on Excel. We Export the data from an Access query to Excel and at that time the user has to update the Month Reported and Year Reported fields on each record within that query. Can I set up something to where the user can click a button or something and Access do all of this automatically? Example: May 2005 was just sent out and we exported the data from the query to Excel and went back into the query and chose update query and had Access fill in May (in the month reported field) and 2005 (in the year reported field) on all of the records. Any help is appreciated, thanks...
View Replies !
Error When "Quit"
Hello all, I need some help. I have a macro done in the menu macro, not on VB that imports some tables, run querys etc. The last step on the macro is "Quit", when the macro gets there I get the following error: You can't exit Microsoft Office Access now. If you're running a Visual Basic module that is using OLE or DDE, you may need to interrupt the module. Can somebody please help me? Thanks,
View Replies !
|