• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

how to use Word Automation methods by MFC

I met some mistakes when using Word Type library,I don't know how to use these argument.
for example,when I call Shapes.AddTextbox() as below:

COleVariant bgAnchor;
Shape myShape = myShapes.AddTextbox(wdTextOrientationHorizontal,0, 0, 72, 384, bgAnchor);

I met an error "type mistake".

there is a simular mistake when I call Shapes.AddPicture() as below:
COleVariant m_True((short)TRUE),m_False((short)FALSE);

Range myRange = mySelection.GetRange();
InlineShapes myPic = myShapes.AddPicture("D:\\MyDocments\\My Pictures\\IMG_8415.JPG",
               m_False, m_False, 0, 0, 72, 384, myrange);

I need answer urgently,please help me.
0
jinyleo
Asked:
jinyleo
  • 3
  • 2
1 Solution
 
_corey_Commented:
Have you tried: msoTextOrientationHorizontal ?

Does it say what parameter it errors on?
0
 
jinyleoAuthor Commented:
msoTextOrientationHorizontal is VBA constant, I can not complied when i used this,VC6 complier said this keyword is not declared. I copyed an header file from network which contains wdTextOrientationHorizontal constant,then complied successful.I do not think this is the reason.
0
 
_corey_Commented:
Yea, I noticed that too.  I just thought it might be defined.

So that's not the issue then, but what variable does it say has the "type mistake" ?
0
 
jinyleoAuthor Commented:
I do not know yet, perhaps I need to define variant  bgAnchor with clear type, but which type should be approriate here?

0
 
_corey_Commented:
I'm not sure what needs to be set for that variant.  Perhaps you don't need it then, just take out that parameter and see if you still get the same problem.  At least for the shapes AddTextbox call.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now