0

I've some issues with OLEObjects and recordsets...

I create some controls on the fly in my code. I prepare them, I fill them, and then I use the data collected from them to run a query on an AS400 (adodb).

When I get the data back I've this issue :

my oleobjects on top of the worksheet start acting weird: they seem normal, but when I click on one of them, the Left property seems to change. While holding the mouse button down I see the control twice, once where it should be, and at another position offset to the right (let's call it the buggy version). If my pointer leaves the control it returns to its normal position.

The globality of the control reacts to my mouse click for offsetting the control to the right and showing its "Buggy version", but the normal behaviour (Click is the only event I manage) only happens if I click on the Buggy Version... Each time I run the query the buggy controls are more and more offset to the right.

Here are some pictures :

Start: all is ok

enter image description here

First query: behaviour after the first run when I click on the left part of the button:

first query

Second query: same, but the offset is greater:

second query

When I don't click on the controls they are like in the first picture.

This affects all my controls except the first 3 which are at left = 0

I hope I was clear and that someone has an idea about what is happening.

Yosh
  • 1
  • 2
  • For #1, What is the error you receive? For #2 try setting the Placement of the control to 2, e.g. CommandButton1.Placemnet = 2 – Jeremy Hodge Oct 16 '19 at 16:25
  • Is placement=2 equivalent to xlfreefloating ? If yes it's already set that way – Yosh Oct 16 '19 at 16:30
  • For the copyfromrecorset it World partially, i've the rows i've asked on the limit statement follower by empty lines and then an unable to copy from recorset error. – Yosh Oct 16 '19 at 16:33
  • xlFreeFloating is 3, my error. You can try 2 (xlMove) and see how it behaves. – Jeremy Hodge Oct 16 '19 at 16:33
  • 2
    Sorry for poor english i fight with l'y french autocorrect – Yosh Oct 16 '19 at 16:35
  • Yosh, strictly speaking, this quesiton is "too broad" because you ask more than one thing. You can use the [edit] link to remove the first question so that this conforms to the site's rules and ask it in a second question... – Cindy Meister Oct 16 '19 at 18:31
  • Oh ok, sorry, edit done ! – Yosh Oct 17 '19 at 06:32
  • After the query, I do some stuff on the result, with a step by step execution I saw that the problem happen when this line of code is executed : ActiveSheet.ListObjects.Add(xlSrcRange, Range(Cells(6, 1), Cells(LastRow, LastCol)), , xlYes).Name = "Tableau1" – Yosh Oct 17 '19 at 06:33
  • Ok, so my problem come from the association of the xlFreefloating placement value for my controls and the presence of a Table on the sheet. If I take one away all is ok... any idea ? – Yosh Oct 21 '19 at 14:41

0 Answers0