Click here to Skip to main content
15,444,571 members

Comments by matblue25 (Top 27 by date)

matblue25 23-Sep-22 12:14pm View     CRLF
Thanks but that seems like cheating. :) I did do some searching in the MS documentation. Deleting a sheet is supposed to pop up a confirmation dialog box. The Delete() method returns a boolean True or False depending on whether the user confirmed the delete or not. In one example snippet, somebody added this: xlApp.DisplayAlerts = false; worksheet.Delete(); xlApp.DisplayAlerts = true; to disable the popup. None of that explains why it would work in one place in your code and not another unless maybe you have DisplayAlerts turned off in the part of the code where it works.
matblue25 23-Sep-22 11:40am View    
No error messages or anything? Yeah, seems like it should either work or error?
matblue25 12-Aug-22 14:37pm View     CRLF
You need to think about what you're trying to accomplish. There are two things you need to make the chart. X-axis values, in radians, from 0 to 2*pi, with the number of samples equal to samplerate/freq. Then the Y-axis values being the sine of the x-axis value. So, the only difficulty is determining what all the X-axis values are, evenly spaced from 0 to 2*pi divided by the number of samples. It looks like you're only trying to plot one "wave" of the sine curve, no matter what the frequency. Note that, in your C# code, you're using the Math.Sin function for both the X and Y values (in your case, Y is "t"). You might be confused because the Matlab code has them reversed. What it calls "x" is the sine value (plotted on the Y-axis) and its "t" is the X-axis, in seconds.
matblue25 3-Aug-22 22:23pm View    
Run it in debug and check the value of destinationWorkbook.Worksheets(1) inside CopyTotalsSheet(). You may need to set it in that method. From the code you supplied, I can’t tell where destinationWorkbook is declared and whether it’s still pointing to the open destination file in the CopyTotalsSheet method.
matblue25 3-Aug-22 13:04pm View     CRLF
Why square brackets instead of parentheses? Worksheets["Totals"]