Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-11-2020, 03:53 AM
SparkoUK SparkoUK is offline If Fields and custom properties testing values with spaces Windows 10 If Fields and custom properties testing values with spaces Office 2016
Novice
If Fields and custom properties testing values with spaces
 
Join Date: Jun 2020
Posts: 3
SparkoUK is on a distinguished road
Angry If Fields and custom properties testing values with spaces

I have a problem with IF testing custom properties with spaces in the values. in a field BILLING I have values like.

00 Admin
00 Accounting

These cannot be changed they are generated by an external system. No macros can be used in startup either security paranoia and getting that approved.

so in the document they want it to put Finance or Accounting and drop the 00. So I assumed an if test would help.

{IF {DOCPROPERTY BILLING} = "00 Admin" "Administration" {IF {DOCPROPERTY BILLING} = "00 Accounting" "Accounting" ""}}

However the string comparison of the fields always stops at the space in the Custom property. So 00 Admin in the custom property will even match 00UtterRubbish in the if test. has anyone any ideas how to get round this or do this another way using only fields without changing the Custom field content?

Note I would even settle for just chopping of the 00 in the output unfortunately fields do not support mid$.


Thanks Adrian.
Reply With Quote
  #2  
Old 06-11-2020, 04:19 AM
SparkoUK SparkoUK is offline If Fields and custom properties testing values with spaces Windows 10 If Fields and custom properties testing values with spaces Office 2016
Novice
If Fields and custom properties testing values with spaces
 
Join Date: Jun 2020
Posts: 3
SparkoUK is on a distinguished road
Default

Interestingly in Office 2016 reversing either side of the if test seems to work i.e IF "00 Admin" = {DOCPROPERTY BILLING}

However this has to work under 2010, nightmare I know.
Reply With Quote
  #3  
Old 06-11-2020, 05:53 AM
macropod's Avatar
macropod macropod is offline If Fields and custom properties testing values with spaces Windows 7 64bit If Fields and custom properties testing values with spaces Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
{IF "{DOCPROPERTY BILLING}" = "00 Admin" "Administration"}
{IF "{DOCPROPERTY BILLING}" = "00 Accounting" "Accounting"}
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 06-11-2020, 09:57 AM
SparkoUK SparkoUK is offline If Fields and custom properties testing values with spaces Windows 10 If Fields and custom properties testing values with spaces Office 2010
Novice
If Fields and custom properties testing values with spaces
 
Join Date: Jun 2020
Posts: 3
SparkoUK is on a distinguished road
Default

Quotes did the trick, thank you
Reply With Quote
Reply

Tags
if fields, properties

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint Custom Properties chopradeepti PowerPoint 1 01-15-2020 01:05 AM
Add custom doc properties in "Doc properties control" eazysnatch Word 2 09-13-2017 08:08 PM
Testing multiple values of two independant variables and charting results sgcannon Excel 0 10-20-2015 10:10 AM
Custom Properties b-baker Word 1 03-01-2012 01:15 AM
Looping though Custom Properties in VBA suekay Misc 0 05-19-2006 06:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:29 AM.


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