Home > Software engineering >  Vb operation problems appeared in the process of word format
Vb operation problems appeared in the process of word format

Time:10-01

Now you need to use vb to stick a picture and the excel charts in word document, the requirements of the format for images from top to bottom, excel chart 1, excel chart 2, excel chart 3

When procedure call word2007, format and sequence is normal, but when invoking word2010 images to run to the end of the file, strives for the great god,

Project reference 14.0 Microsoft excel object library and Microsoft word 14.0 object library

Attach relevant code

WordApp. Selection. TypeText CRH (13)
WordApp. Selection. ClearFormatting
WordApp. Selection. ParagraphFormat. Alignment=wdAlignParagraphCenter
WordDoc. InlineShapes. AddPicture workpath & amp; "\ drawing quality diameter. BMP," in the word report paste
WordApp. Selection. TypeText CRH (13)
WordApp. Selection. TypeText "figure 1 shaft diameter drawing quality"
WordApp. Selection. TypeText CRH (13)


TempxlWorkbook. Worksheets (" Sheet1 "). ChartObjects (1). The Activate
TempxlWorkbook. Worksheets (" Sheet1 "). ChartObjects (1) Chart. CopyPicture
WordApp. Selection. ClearFormatting
WordApp. Selection. ParagraphFormat. Alignment=wdAlignParagraphCenter
WordApp. Selection. Paste 'in the word report Paste Yang degree graph
WordApp. Selection. TypeText CRH (13)
WordApp. Selection. TypeText "figure 2 axis each node Yang curve"
WordApp. Selection. TypeText CRH (13)

WordApp. Selection. TypeText CRH (13)
TempxlWorkbook. Worksheets (" Sheet1 "). ChartObjects (2). The Activate
TempxlWorkbook. Worksheets (" Sheet1 "). ChartObjects (2) Chart. CopyPicture
WordApp. Selection. ClearFormatting
WordApp. Selection. ParagraphFormat. Alignment=wdAlignParagraphCenter
WordApp. Selection. Paste 'in the word report Paste bending stress graph
WordApp. Selection. TypeText CRH (13)
WordApp. Selection. TypeText "figure 3 shafting bending stress curve of all nodes"

WordApp. Selection. TypeText CRH (13)
TempxlWorkbook. Worksheets (" Sheet1 "). ChartObjects (3). The Activate
TempxlWorkbook. Worksheets (" Sheet1 "). ChartObjects (3) Chart. CopyPicture
WordApp. Selection. ClearFormatting
WordApp. Selection. ParagraphFormat. Alignment=wdAlignParagraphCenter
WordApp. Selection. Paste 'in the word report Paste bending stress graph
WordApp. Selection. TypeText CRH (13)
WordApp. Selection. TypeText "figure 4 axis each node bending moment curve"

CodePudding user response:

2007 and 2010 have to refer to different versions of the object library, I think,

CodePudding user response:

2007 and 2010 have to refer to different versions of the object library, I think is
  •  Tags:  
  • VBA
  • Related