Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-27-2021, 04:07 AM
JamesWood JamesWood is offline Public function string problem Windows 10 Public function string problem Office 2019
Advanced Beginner
Public function string problem
 
Join Date: Nov 2020
Posts: 37
JamesWood is on a distinguished road
Question Public function string problem

Hi guys




I have this public string code:


Public Function docNameFieldPreview() As String
docNameFieldPreview = ActiveDocument.MailMerge.DataSource.DataFields("Name").Value
End Function


This works, but if I replace the name section with another string I have, it says "The requested member of the collection does not exist."


Public Function docNameFieldPreview() As String
docNameFieldPreview = ActiveDocument.MailMerge.DataSource.DataFields(docNameField).Value
End Function


Any thoughts? docNameField has been dimmed elsewhere, and does work in other areas of the code that use it, so I'm not sure why it won't work in this particular string.


Thanks a lot
James
Reply With Quote
 

Tags
function, public, string



Similar Threads
Thread Thread Starter Forum Replies Last Post
Public function string problem Mistake in the help file for String "Split Function"? John 4 Word VBA 6 11-19-2020 06:02 AM
Problem with function PRA007 Word VBA 2 01-13-2016 01:11 AM
Public function string problem How to get the Right function to return a string that has UPPERCASE letters only adj Word VBA 9 08-30-2014 09:21 PM
How to reserve an array in a public function? tinfanide Word VBA 2 02-27-2012 06:51 AM
Public function string problem Macro or Function to know wether a string is included in a text Eduardo Word VBA 5 06-15-2009 01:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft