arzoo
07-25-2008, 12:12 AM
Hi, I use the following code from access to update certain cells in an existing excel sheet.
Dim xl As Excel.Application
Dim xlsht As Excel.workSheet
Dim xlWrkBk As Excel.workBook
Dim ExcelFile As String
ExcelFile = "C:\" & PrtlFile
Set xl = CreateObject("Excel.Application")
Set xlWrkBk = GetObject(ExcelFile)
Set xlsht = xlWrkBk.Worksheets("Sheet1")
xlsht.Cells(12, 2) = PrtlFile
xlsht.Cells(13, 2) = PrtlID
xlsht.Cells(14, 2) = IDNo
xlsht.Cells(15, 2) = IDName
xlsht.Cells(15, 3) = IDAddress
xlWrkBk.Close
My problem is that each time this procedure is run, the warning to run macros appears when it is about to write to excel and then asks for confirmation to save changes to the sheet when closing.
Is it possible to do this in a seamless way, such that the user in access will not notice that access is processing the excel sheet and he does not have to keep confirming message boxes shown by excel.
Dim xl As Excel.Application
Dim xlsht As Excel.workSheet
Dim xlWrkBk As Excel.workBook
Dim ExcelFile As String
ExcelFile = "C:\" & PrtlFile
Set xl = CreateObject("Excel.Application")
Set xlWrkBk = GetObject(ExcelFile)
Set xlsht = xlWrkBk.Worksheets("Sheet1")
xlsht.Cells(12, 2) = PrtlFile
xlsht.Cells(13, 2) = PrtlID
xlsht.Cells(14, 2) = IDNo
xlsht.Cells(15, 2) = IDName
xlsht.Cells(15, 3) = IDAddress
xlWrkBk.Close
My problem is that each time this procedure is run, the warning to run macros appears when it is about to write to excel and then asks for confirmation to save changes to the sheet when closing.
Is it possible to do this in a seamless way, such that the user in access will not notice that access is processing the excel sheet and he does not have to keep confirming message boxes shown by excel.