Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default concatenation question

Hello

I'm guessing this isn't allowed but I'd welcome confirmation

Can one concatenate a variable into a VBA command

So for example

instead of userform1. windowsmediaplayer1.controls.currentposition

could you have

userform1. windowsmediaplayer & ("range a1") & .controls.currentposition

If so what would the correct syntax be?

Many thanks





  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default concatenation question


"Don Guillett" wrote in message
...
In WHICH group do you want an answer?


err this one?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default concatenation question


Then try your solution and post back
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"teepee" wrote in message
...

"Don Guillett" wrote in message
...
In WHICH group do you want an answer?


err this one?



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default concatenation question


"Don Guillett" wrote in message
...

Then try your solution and post back


compile error: method or data member not found
and it highlights the words ".windowsmediaplayer"




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default concatenation question

To test I have the following macro, where cell a1 contains the value 1

Sub test ()
dim value as long
value = userform1.windowsmediaplayer & range ("a1") &
..controls.currentposition
'value = userform1.windowsmediaplayer1controls.currentposit ion
msgbox value
end sub

when I hash out the third line and unhash the fourth it successfully return
the messagebox value zero.

Most grateful if anyone can tell me if (a) I'm wasting my time with this
approach or (b) the correct syntax



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default concatenation question

Try it this way

Sub test ()
dim value as long
value = userform1.windowsmediaplayer" & range ("a1") &
".controls.currentposition
'value = userform1.windowsmediaplayer1controls.currentposit ion
msgbox value
end sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"teepee" wrote in message
...
To test I have the following macro, where cell a1 contains the value 1

Sub test ()
dim value as long
value = userform1.windowsmediaplayer & range ("a1") &
.controls.currentposition
'value = userform1.windowsmediaplayer1controls.currentposit ion
msgbox value
end sub

when I hash out the third line and unhash the fourth it successfully
return the messagebox value zero.

Most grateful if anyone can tell me if (a) I'm wasting my time with this
approach or (b) the correct syntax




  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default concatenation question

Thanks Don

It reports a syntax error however



"Don Guillett" wrote in message
...
Try it this way

Sub test ()
dim value as long
value = userform1.windowsmediaplayer" & range ("a1") &
".controls.currentposition
'value = userform1.windowsmediaplayer1controls.currentposit ion
msgbox value
end sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"teepee" wrote in message
...
To test I have the following macro, where cell a1 contains the value 1

Sub test ()
dim value as long
value = userform1.windowsmediaplayer & range ("a1") &
.controls.currentposition
'value = userform1.windowsmediaplayer1controls.currentposit ion
msgbox value
end sub

when I hash out the third line and unhash the fourth it successfully
return the messagebox value zero.

Most grateful if anyone can tell me if (a) I'm wasting my time with this
approach or (b) the correct syntax






  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default concatenation question


Use code tags around code. Posting code without them makes your code
hard to read and difficult to be copied for testing. Highlight your code
and click the # at the top of your post window.


--
Pecoflyer
------------------------------------------------------------------------
Pecoflyer's Profile: http://www.thecodecage.com/forumz/member.php?userid=14
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=24214



  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default concatenation question


"Don Guillett" wrote in message
...
I don't use many userforms but try this


sadly that returns the information as a text string "userform1.
windowsmediaplayer1.controls.currentposition" rather than as a value.



  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default concatenation question


"Pecoflyer" wrote in message
...

Use code tags around code. Posting code without them makes your code
hard to read and difficult to be copied for testing. Highlight your code
and click the # at the top of your post window.


Apologies I'm using outlook express today which doesn't seem to do such
things


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenation MichaelS Excel Discussion (Misc queries) 8 September 11th 08 07:54 AM
Help with Concatenation alex Excel Worksheet Functions 3 August 28th 07 06:09 PM
Concatenation Harry Excel Worksheet Functions 2 July 17th 06 07:17 PM
Concatenation question ~C Excel Worksheet Functions 1 February 2nd 06 10:14 PM
Concatenation Help Henry Excel Worksheet Functions 4 December 15th 04 08:21 PM


All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"