Word VBA - If statements with bookmarks

Matt Smith 1 Reputation point
2020-07-07T17:51:41.707+00:00

I'm a true beginner at VBA, so please excuse my lack of vocabulary.
I'm using merge fields from excel to populate a 'paragraph' in word. Here it is.

084113 Exterior Storefront – Total «SF1T» Labor «SF1L»
«SF1Manu» «SF1Name» | «SF1Finish» with «SF1Year» Year Warranty | 1” Insulated Clear SolarBan70XL | 2 Beads of Caulk
«SF1Q» Total Openings | Approx. «SF1SF» SF

I've bookmarked the entire selection as SF1. Also, I've bookmarked the mail merge field <<SF1Q>> as SF1R. What I'm trying to accomplish is to delete SF1 entirely if SF1R is equal to 0. I'm struggling with Declaring (Dim) SF1R as an Interger or Long. I'm not sure if it is required. I'm attempting to create an if statement that looks like this: If ActiveDocument.Bookmarks("SF1R") = 20 Then Delete SF1 and I'm getting all kinds of errors! If someone can let me know what kind of declarations are required and help in constructing my if statement it would be greatly appreciated!

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,591 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Leon Laude 85,716 Reputation points
    2020-07-07T17:55:02.493+00:00

    Hi,

    VBA is currently not supported in the Q&A forums, the supported products are listed over here https://learn.microsoft.com/en-us/answers/products (more to be added later on).

    You can ask the experts in the dedicated VBA forum over here:
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba

    (Please don't forget to accept helpful replies as answer)

    Best regards,
    Leon

    0 comments No comments

  2. Anonymous
    2020-07-07T18:05:15.22+00:00

    Word development is not currently supported here on QnA. They're actively answering question in dedicated forums here.
    https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-msoffice_custom
    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=worddev

    --please don't forget to Accept as answer if the reply is helpful--


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    0 comments No comments

  3. Matt Smith 1 Reputation point
    2020-07-07T19:29:25.82+00:00

    these microsoft forums are too vast. I attempted to post there, but it didn't allow me to post a link or picture (even though I didn't) until my account is verified. I believe it is. I purchased office 365 about 2 weeks ago and have an 'account.' It is very frustrating.

    just followed the link again and same return message


  4. Anonymous
    2020-07-07T19:32:14.417+00:00

    You can expedite verification in MSDN/TechNet forums by replying to this thread with your request.
    https://social.msdn.microsoft.com/Forums/en-US/94f05325-8566-4c4c-806c-179a5a0beafc/verify-accounts-43?forum=reportabug
    Sticky located at top of Forums Issues (not product support) forum
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=reportabug

    --please don't forget to Accept as answer if the reply is helpful--


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    0 comments No comments