Share via

Code conversion from VBA to c#

Anonymous
2024-06-18T13:37:42+00:00

Hello.

I have Word VBA macros with this method:

Selection.InsertCaption Label:="Table. ", TitleAutoText:="InsertCaption1", _

    **Title:="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0**

But in C# VSTO it doesn't work:

Globals.ThisAddIn.Application.Selection.InsertCaption(Label: "Table.", TitleAutoText: "InsertCaption1", Title: "", Position: WdCaptionPosition.wdCaptionPositionBelow, ExcludeLabel: 0);

Why?

BR, Vasily

***moved from Microsoft 365 and Office / Word / For home / Windows***

Microsoft 365 and Office | Install, redeem, activate | Other | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-06-19T13:02:08+00:00

    Hi Василий Зайцев1,

    Thanks for your post in Microsoft Community.

    Based on your description, it seems like that you have some doubts about VBA and C#.

    Well, there is a better place to publish which is Stack Overflow.

    Ask VBA or C# programming questions to Stack Overflow by using the VBA or C# tag along with any other relevant tags.

    Please note that Stack Overflow includes guidelines, such as requesting a descriptive title, a complete and concise problem description, and sufficient details to reproduce your problem. Feature requests or questions that are too broad are considered off-topic.

    Disclaimer: Microsoft provides no assurances and/or warranties, implied or otherwise, and is not responsible for the information you receive from the third-party linked sites or any support related to technology.

    I can't help you, but I'll leave this question open in case one of our great volunteers has ideas for you.

    Best regards,

    Thomas C - MSFT | Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-06-19T09:48:12+00:00

    The problem was with № symbol in style name!

    Was this answer helpful?

    0 comments No comments