我在这里要做的是给工作表中的所有形状一个数字。 每个形状的数量必须加1 所以看起来应该是这样的。
请记住,这些形状是动态的(它不总是2列,3行)
这是我尝试的代码,但似乎无法正常工作
Sub Nummer()
Dim lngShapes As Long
lngShapes = ActiveSheet.Shapes.Count
For teller = 1 To lngShapes
ActiveSheet.Shapes(teller).Value = teller
Next
End Sub
答案 0 :(得分:1)
在尝试在形状中设置值(文本)时,您得到void Image(HDC hDC, string File_Name, int x_position, int y_position, int length, int height) // Image()
{
File_Name = "C:/Users/David/Pictures/" + File_Name + ".bmp"; // add a full path to the file name
bitmap_image image(File_Name); // Open the bitmap
unsigned char red;
unsigned char green;
unsigned char blue;
restart:
image.get_pixel(x_position, y_position, red, green, blue); // Get the red green and blue from x_position and y_position and store it in red green and blue.
glBegin (GL_TRIANGLES); // Make a pixel at x_position and y_position with red green and blue.
glColor3ub (red, green, blue);
glVertex2f (-1 + 0.0015 * x_position, 1 - 0.003 * y_position);
glVertex2f (-1 + 0.0015 * x_position, 0.997 - 0.003 * y_position);
glVertex2f (-0.9985 + 0.0015 * x_position, 1 - 0.003 * y_position);
glEnd();
glBegin (GL_TRIANGLES);
glColor3ub (red, green, blue);
glVertex2f (-1 + 0.0015 * x_position, 0.997 - 0.003 * y_position);
glVertex2f (-0.9985 + 0.0015 * x_position, 1 - 0.003 * y_position);
glVertex2f (-0.9985 + 0.0015 * x_position, 0.997 - 0.003 * y_position);
glEnd();
if (x_position==length) // If x_position equals to length of bmp set x_position to 0 and add 1 to y_position.
{
if (y_position==height) // If bmp is done loading go to done.
{
goto done;
}
x_position = 0;
y_position = y_position + 1;
}
x_position = x_position + 1;
goto restart;
done:
SwapBuffers(hDC); // Put it on the screen
}
int main() // int main()
{
POINT p;
if(GetCursorPos(&p))
{
Image(hDC, "Image", p.x, p.y, 1340, 678);
}
}
因为形状集合没有要设置的SELECT max(date(date_posted)) FROM my_table
WHERE ("SELECT count( DISTINCT my_id ) AS 'a'
FROM my_table
WHERE date_posted > date_sub( current_date, INTERVAL 1 DAY )
)
属性。您需要使用Error 438
如果更改了行
Value
到
.TextFrame.Characters.Text
您的代码将有效。
答案 1 :(得分:1)
似乎问题实际上是“遍历表格中的所有形状”。应该使用以下内容:
ActiveSheet.Shapes(teller).Value = teller
我们在此声明 ActiveSheet.Shapes(teller).TextFrame.Characters.Text = teller
为变量名称Sub nameTheShapes()
Dim shp As Shape
For Each shp In Sheet1.Shapes
shp.TextFrame2.TextRange.Characters.Text = shp.ID
Next
End Sub
。然后,我们遍历shape
中的所有shp
。然后我们将形状shapes
写入形状sheet1
。
如果您在同一页面上挂了一些图表,那么您可能不希望包含它们,因此您可以测试id
属性以查看它不是图表:
textframe2