View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Robert M. Franz (RMF) Robert M. Franz (RMF) is offline
external usenet poster
 
Posts: 1,741
Default Automation returns incorrect data (Threading.Thread.Sleep fixes)

Hi Brett

Brett Shearer wrote:
I am reading large word documents to create c# source files and need to use
the texture of a cell to separate the data I need.

Without the sleep command the cell shading texture is not always returns
correctly.
Is there a better (correct) way to handle this?

if (identifier.StartsWith("Record Identifier"))
{
if (table.Cell(1, 1).Shading.Texture != WdTextureIndex.wdTexture15Percent)
{
System.Threading.Thread.Sleep(1000);
}
if (table.Cell(1, 1).Shading.Texture == WdTextureIndex.wdTexture15Percent)
{
ProcessTable(table);
}
}


Since you haven't received an answer so far, and if you're still looking
for a solution, I'd try one of the .vba newsgroups (if you ask nicely
whether such timing troubles are known when using VBA, they might be
able to help you).

HTH
Robert