Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 02-29-2024, 07:10 AM
gmaxey gmaxey is offline Macro to check the data in a content control box Windows 10 Macro to check the data in a content control box Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

A variant variable can hold strings. An array of strings e.g., Dim ctrlTitle() as String cannot resolve a variant array.


Consider:
Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim strVar() As String 'Here we have declared a string variable as an array of strings
Dim strVar2 As String
Dim varVar 'Here we have declared a variant variable
Dim lngNum As Long
  strVar = Split("A,B,C", ",")
  'A variant variable can be a string
  varVar = strVar
  'Here we set our variant variable to the variant returned by the Array funciton
  varVar = Array("A", 1, "C", 2.4)
  'While some other variable types are automatically resolved e.g., ...
  lngNum = 100
  strVar2 = lngNum
  '... a variant array cannot be resolved to a string
  On Error GoTo Err_Handler
  strVar = varVar
lbl_Exit:
  Exit Sub
Err_Handler:
  MsgBox "Do you see?"
  Resume lbl_Exit
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Use VBA to show text when content control check box is checked kvrieze Word VBA 1 08-19-2023 03:11 AM
MsgBox launch when a Check Box Content Control is clicked wolfgrrl Word VBA 1 06-21-2019 12:13 PM
Macro to check the data in a content control box Check box content control to show text when checked Strogg Word 3 02-10-2019 11:45 AM
Check Box Content Control when checked users are presented with an option cryder Word 0 01-07-2016 05:11 AM
Macro to check the data in a content control box Replace checkbox symbol with check box content control canadansk Word VBA 5 04-01-2015 08:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:29 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