Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-14-2012, 03:45 AM
Wries Wries is offline Array argument in macro command Windows XP Array argument in macro command Office 2007
Advanced Beginner
Array argument in macro command
 
Join Date: Jun 2009
Posts: 40
Wries is on a distinguished road
Default Array argument in macro command


Hello All,
Is it possible to put an argument from an array directly into command?
I get error "method or data member not found"
Speaking in examples:
i have simplified the values for the purpose of my question
i have userform (CmNm) with check boxes (BoxA, BoxB...)
after clicking on import button i want it to check if boxes in CmNm are ticked and for those that are to do the import
i get error on: CmNm.Box & Element
when i manually write CmNm.BoxA instead (while omitting the For command) it is working, but i have to do each array value manually

Code:
Dim cm, nm As String
Dim hotels
cm = Format(Date, "mmyy")
nm = Format(DateAdd("m", 1, Date), "mmyy")
letters = Array("A", "B", "C")
 
For Each Element In letters
  If CmNm.Box & Element = True Then
    Worksheets("Main").CheckBoxes(Element & cm) = 1
    Worksheets("Main").CheckBoxes(Element & nm) = 1
    Application.Run (Element & "Import")
  End If
Next Element
End Sub
Thank you in advance,
Kind regards,
Wries

Last edited by macropod; 11-17-2012 at 08:26 PM. Reason: Added code tags & formatting
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Array argument in macro command Complex array formula andrei Excel 9 02-03-2012 03:40 AM
How to capture start and ending Ref. Nos. in an array KIM SOLIS Excel 5 09-07-2011 07:43 AM
Word doc bug when closing from userform command button click macro Joe Patrick Word 1 07-05-2011 08:53 PM
Command Line Argument xJediDadx Outlook 1 02-21-2011 03:47 PM
Array argument in macro command Array into ComboBox + Macro-Text into ActiveDocument Vivi Word VBA 1 01-27-2010 07:03 AM

Other Forums: Access Forums

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