-
Jul 20th, 2021, 11:24 AM
#1
Thread Starter
New Member
Trouble updating field value with VBA
I have created a .docm file that contains a docvariable field called "previousBL". However, in my VBA code, when I try to run ActiveDocument.FormFields("previousBL").Select, I get an error that says "The requested member of the collection does not exist." I have tried using ActiveDocument.Fields, but then I get a "Type mismatch" error. I am calling this function from a DXL script, but even if I try to run it on my own, I get the same issue. I'm hoping that someone can help me out as this function is adding the contents of an HTML file to the end of a pre-configured .docm file then trying to edit this field.
Chris
-
Jul 20th, 2021, 01:38 PM
#2
Re: Trouble updating field value with VBA
Post the code you are using, or upload a sample workbook.
-
Jul 21st, 2021, 03:34 AM
#3
Re: Trouble updating field value with VBA
the error is pretty clear there is no formfield with that name or the field can only be addressed by index
post a sample of the document and someone will attempt to provide the correct method to access the field
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|