Change value of combobox

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Change value of combobox

Post by VegasNath »

I have tried using the macro recorder to change the value of a combobox without success.

wb0.Sheets("Report").OLEObjects.ComboBox1.Value = Format(strDate, "dd mmmm yyyy")

Can anyone see where am I going wrong with my syntax?
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78519
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Change value of combobox

Post by HansV »

Does this work?

wb0.Sheets("Report").OLEObjects("ComboBox1").Value = Format(strDate, "dd mmmm yyyy")
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Change value of combobox

Post by VegasNath »

No.
It's a combo box from the control toolbox.
:wales: Nathan :uk:
There's no place like home.....

User avatar
HansV
Administrator
Posts: 78519
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Change value of combobox

Post by HansV »

Sorry, forgot an essential part:

wb0.Sheets("Report").OLEObjects("ComboBox1").Object.Value = Format(strDate, "dd mmmm yyyy")
Best wishes,
Hans

User avatar
VegasNath
5StarLounger
Posts: 1185
Joined: 24 Jan 2010, 12:02
Location: Wales, UK.

Re: Change value of combobox

Post by VegasNath »

Great, Thanks Hans
:wales: Nathan :uk:
There's no place like home.....