Automation returns incorrect data (Threading.Thread.Sleep fixes)

B

Brett Shearer

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);
}
}
 
R

Robert M. Franz (RMF)

Hi Brett

Brett said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top