I have a question, been racking my brain trying to figure out why this is happening.
Let me start off with a chunk of code. This takes values from a textbox and writes them to an Excel sheet:
Public Sub printFrmDUIReportPreview() '// =============================== PRINT PREVIEW DUI REPORT FORM ================================== '// Put up a quick message box telling people to be patient while this prints. MsgBox("Please be patient while we build your DUI report and send it to the printer. It may take up to 45 seconds. ", MsgBoxStyle.Information, "Your DUI Report Is Being Built") '// Start a new workbook from a template in Excel. Try Dim oExcel As Object = CreateObject("Excel.Application") If File.Exists(x.myDUI_ReportXlsxFile) Then '//----- check if file exists. '//------ Open the log template Dim oBook As Object = oExcel.Workbooks.Open(x.myDUI_ReportXlsxFile) Application.DoEvents() '// GIVE IT A SECOND TO GET ITSELF TOGETHER '// Add data to cells of the first worksheet in the daily log template. '//-- Top row with name, supervisor, etc.. Dim oSheet As Object = oBook.Worksheets(1) With (oSheet) '// less code. oSheet = oBook.Worksheets(1) '//============= PAGE 1 OF 7 ======================= .Range("A1").Value = frmDUI_Interview.txtAgency.Text .Range("N3").Value = frmDUI_Interview.txtDUICitationNumber.Text .Range("C20").Value = frmDUI_Interview.txtAssistOfficer1.Text .Range("J20").Value = frmDUI_Interview.txtAssistOfficer2.Text '// PRINT Application.DoEvents() '// GIVE IT A SECOND TO GET ITSELF TOGETHER oExcel.Visible = True '//Open Excel .PrintPreview() '//Excel Print Preview ' This will and/or should kill Excel from the Task Manager Processes- Excel.exe ' add all running processes to an array. Dim myTaskbarProcesses() As Process = Process.GetProcesses() ' loop thru the process array and locate 'excel' to terminate it. For Each myProcess As Process In myTaskbarProcesses If myProcess.ProcessName.ToLower = "excel" Then ' added as precaution since it might show up capitalized or not in other operating systems. myProcess.Kill() End If Next End With '// GARBAGE COLLECTOR GC.Collect() GC.WaitForPendingFinalizers() Else MsgBox("DUI Report Printing Error. Contact DailyLog.net and let them know", MsgBoxStyle.Critical, "Print Error") End If Catch ex As Exception 'MsgBox("Error saving as Excel", MsgBoxStyle.Critical, "Save Error") End Try
The problem is this: Some users on WinXP are telling me some text fields are not transferring to the spreadsheet. I don't seem to have this problem on Win7.
Is there any logical reason why this could or would happen? There are about a hundred different fields. There are a few that are hit and miss according to the users. Yet I can never duplicate it on my end, even when I use WinXP or Win7. I have also tried the last two newest versions of Office. I just can never duplicate it.
Anyone have anything off the top of their head that might be able to send me in the right direction?
Thanks in advance...