ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   concatenation query (https://www.excelbanter.com/excel-programming/419425-concatenation-query.html)

teepee[_3_]

concatenation query
 
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



Don Guillett

concatenation query
 
In WHICH group do you want an answer?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"teepee" wrote in message
...
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




Rick Rothstein

concatenation query
 
Try something like this...

UserForm1.Controls("WindowsMediaPlayer" &
Range("A1").Value).Controls.currentPosition

Note: That should all be on one line but I expect newsreaders will wrap the
text because of its length.

--
Rick (MVP - Excel)


"teepee" wrote in message
...
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




teepee[_3_]

concatenation query
 

"Rick Rothstein" wrote in message
...
Try something like this...

UserForm1.Controls("WindowsMediaPlayer" &
Range("A1").Value).Controls.currentPosition


Worked a treat. Many thanks Rick




All times are GMT +1. The time now is 04:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com