I'm not super familiar with what exactly the STAThread does (is), so I'm not sure if my question is even properly stated.
I have a process running in a BackgroundWorker thread that copies the contents of an Excel range to the clipboard (Excel.Range.Copy()
). After the copying, I need to be able to access the Clipboard contents to write them into a text file, but apparently the Clipboard cannot be accessed directly from my BackgroundWorker (when I try to use Clipboard.GetText()
from my BackgroundWorker and write that text into my textfile, no text is passed, even though I can manually do Ctrl-V on a separate text file and paste the contents that have just been copied from the Excel range by the C# process).
I should also mention that I'm running this process in a BackgroundWorker to facilitate the use of a ProgressBar that shows the process status. So, if there's a solution that let's me use my ProgressBar and access the Clipboard contents without using a BackgroundWorker, I absolutely welcome it! Thanks!