Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Problèmes avec Excel

5 réponses
Avatar
Wendake
Encore moi.

J'ai deux loop de lectures un dans l'autre en relation. Quand je fais la
première lecture du premier recordset, tout est correct. La relation avec le
deuxième recordset fonctionne régulièrement et je peux dessiner mon premier
schéma.

Quand je passe à la deuxième lecture du premier recordset j'arrive à
renommer la feuille (ExlWB.Sheets(wFactCount).Name = rsFact!strTableName), à
ajouter le rectangle (AddShape(msoShapeRectangle,.), lui donner un nom, mais
quand j'arrive à « With .ShapeRange » j'ai l'erreur suivant :

Propriété ou méthode non gérée par cet objet

Voila le code et merci:





Set db = CurrentDb

gSQL = "SELECT intTableId, strTableName, strDisplayName" _

& " FROM tblTable" _

& " WHERE intTableTypeId = 3"

Set rsFact = CurrentDb.OpenRecordset(gSQL, dbOpenSnapshot)

With rsFact

.MoveFirst

wFactCount = 0

Do Until .EOF

wFactCount = wFactCount + 1

Set ExlWS = ExlWB.Sheets(wFactCount)

ExlWB.Sheets(wFactCount).Name = rsFact!strTableName

.

ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW,
BoxH).Select

With Selection

.Name = rsFact!strTableName

.Characters.Text = rsFact!strTableName

With .ShapeRange

With .Fill

.Visible = True

.Solid

.ForeColor.SchemeColor = 26

.Transparency = 0#

End With

With .Line

.Weight = 0.75

.DashStyle = msoLineSolid

.Style = msoLineSingle

.Transparency = 0#

.Visible = msoTrue

.ForeColor.SchemeColor = 64

.BackColor.RGB = RGB(255, 255, 255)

End With

.Shadow.Type = msoShadow14

.TextFrame.MarginLeft = 0#

.TextFrame.MarginRight = 0#

End With

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlCenter

With .Font

.FontStyle = "ARIAL"

.Size = 12

.ColorIndex = xlAutomatic

End With

End With

'-----------------------------------------------------------------------
Next fact

.MoveNext

Loop

.Close

End With

5 réponses

Avatar
Michel__D
Bonjour,

Le problème est à ce niveau :

With Selection

car lorsque tu es sous Excel la propriété s'applique de manière implicite
à l'objet Application (Excel), mais ici tu es sous Access il faut donc lui
fournir explicitement l'objet auquel il se réfère à savoir un objet
Application (Excel), cela devrait donner un truc de ce genre :

With ExlApp.Selection


Wendake a écrit :
Encore moi.

J'ai deux loop de lectures un dans l'autre en relation. Quand je fais la
première lecture du premier recordset, tout est correct. La relation avec le
deuxième recordset fonctionne régulièrement et je peux dessiner mon premier
schéma.

Quand je passe à la deuxième lecture du premier recordset j'arrive à
renommer la feuille (ExlWB.Sheets(wFactCount).Name = rsFact!strTableName), à
ajouter le rectangle (AddShape(msoShapeRectangle,.), lui donner un nom, mais
quand j'arrive à « With .ShapeRange » j'ai l'erreur suivant :

Propriété ou méthode non gérée par cet objet

Voila le code et merci:





Set db = CurrentDb

gSQL = "SELECT intTableId, strTableName, strDisplayName" _

& " FROM tblTable" _

& " WHERE intTableTypeId = 3"

Set rsFact = CurrentDb.OpenRecordset(gSQL, dbOpenSnapshot)

With rsFact

.MoveFirst

wFactCount = 0

Do Until .EOF

wFactCount = wFactCount + 1

Set ExlWS = ExlWB.Sheets(wFactCount)

ExlWB.Sheets(wFactCount).Name = rsFact!strTableName

..

ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW,
BoxH).Select

With Selection

.Name = rsFact!strTableName

.Characters.Text = rsFact!strTableName

With .ShapeRange

With .Fill

.Visible = True

.Solid

.ForeColor.SchemeColor = 26

.Transparency = 0#

End With

With .Line

.Weight = 0.75

.DashStyle = msoLineSolid

.Style = msoLineSingle

.Transparency = 0#

.Visible = msoTrue

.ForeColor.SchemeColor = 64

.BackColor.RGB = RGB(255, 255, 255)

End With

.Shadow.Type = msoShadow14

.TextFrame.MarginLeft = 0#

.TextFrame.MarginRight = 0#

End With

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlCenter

With .Font

.FontStyle = "ARIAL"

.Size = 12

.ColorIndex = xlAutomatic

End With

End With

'-----------------------------------------------------------------------
Next fact

.MoveNext

Loop

.Close

End With




Avatar
Wendake
Mais alors ne devrait pas fonctionner aussi avec la première lecture du
recordset, tandis que ça fonctionne parfaitement. En plus « AddShape est
pour une worksheet et non pour un Application



ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW, BoxH).Select



Salut.

"Michel__D" a écrit dans le message de
news:
Bonjour,

Le problème est à ce niveau :

With Selection

car lorsque tu es sous Excel la propriété s'applique de manière implicite
à l'objet Application (Excel), mais ici tu es sous Access il faut donc
lui
fournir explicitement l'objet auquel il se réfère à savoir un objet
Application (Excel), cela devrait donner un truc de ce genre :

With ExlApp.Selection


Wendake a écrit :
Encore moi.

J'ai deux loop de lectures un dans l'autre en relation. Quand je fais la
première lecture du premier recordset, tout est correct. La relation avec
le deuxième recordset fonctionne régulièrement et je peux dessiner mon
premier schéma.

Quand je passe à la deuxième lecture du premier recordset j'arrive à
renommer la feuille (ExlWB.Sheets(wFactCount).Name =
rsFact!strTableName), à ajouter le rectangle
(AddShape(msoShapeRectangle,.), lui donner un nom, mais quand j'arrive à
« With .ShapeRange » j'ai l'erreur suivant :

Propriété ou méthode non gérée par cet objet

Voila le code et merci:





Set db = CurrentDb

gSQL = "SELECT intTableId, strTableName, strDisplayName" _

& " FROM tblTable" _

& " WHERE intTableTypeId = 3"

Set rsFact = CurrentDb.OpenRecordset(gSQL, dbOpenSnapshot)

With rsFact

.MoveFirst

wFactCount = 0

Do Until .EOF

wFactCount = wFactCount + 1

Set ExlWS = ExlWB.Sheets(wFactCount)

ExlWB.Sheets(wFactCount).Name = rsFact!strTableName

..

ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW,
BoxH).Select

With Selection

.Name = rsFact!strTableName

.Characters.Text = rsFact!strTableName

With .ShapeRange

With .Fill

.Visible = True

.Solid

.ForeColor.SchemeColor = 26

.Transparency = 0#

End With

With .Line

.Weight = 0.75

.DashStyle = msoLineSolid

.Style = msoLineSingle

.Transparency = 0#

.Visible = msoTrue

.ForeColor.SchemeColor = 64

.BackColor.RGB = RGB(255, 255, 255)

End With

.Shadow.Type = msoShadow14

.TextFrame.MarginLeft = 0#

.TextFrame.MarginRight = 0#

End With

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlCenter

With .Font

.FontStyle = "ARIAL"

.Size = 12

.ColorIndex = xlAutomatic

End With

End With


'-----------------------------------------------------------------------
Next fact

.MoveNext

Loop

.Close

End With





Avatar
Michel__D
Bonjour,

Exécute en pas en pas, tu verras bien, mais je dois pas être loin de la vérité.

PS:La propriété "Selection" se réfère à l'objet Application (Excel) et ce n'est
pas moi qui l'affirme mais l'aide, d'ailleurs tu ferais bien d'y jeter un oeil.


"Wendake" a écrit dans le message de news:
Mais alors ne devrait pas fonctionner aussi avec la première lecture du
recordset, tandis que ça fonctionne parfaitement. En plus « AddShape est
pour une worksheet et non pour un Application



ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW, BoxH).Select



Salut.

"Michel__D" a écrit dans le message de
news:
> Bonjour,
>
> Le problème est à ce niveau :
>
> With Selection
>
> car lorsque tu es sous Excel la propriété s'applique de manière implicite
> à l'objet Application (Excel), mais ici tu es sous Access il faut donc
> lui
> fournir explicitement l'objet auquel il se réfère à savoir un objet
> Application (Excel), cela devrait donner un truc de ce genre :
>
> With ExlApp.Selection
>
>
> Wendake a écrit :
>> Encore moi.
>>
>> J'ai deux loop de lectures un dans l'autre en relation. Quand je fais la
>> première lecture du premier recordset, tout est correct. La relation avec
>> le deuxième recordset fonctionne régulièrement et je peux dessiner mon
>> premier schéma.
>>
>> Quand je passe à la deuxième lecture du premier recordset j'arrive à
>> renommer la feuille (ExlWB.Sheets(wFactCount).Name > >> rsFact!strTableName), à ajouter le rectangle
>> (AddShape(msoShapeRectangle,.), lui donner un nom, mais quand j'arrive à
>> « With .ShapeRange » j'ai l'erreur suivant :
>>
>> Propriété ou méthode non gérée par cet objet
>>
>> Voila le code et merci:
>>
>>
>>
>>
>>
>> Set db = CurrentDb
>>
>> gSQL = "SELECT intTableId, strTableName, strDisplayName" _
>>
>> & " FROM tblTable" _
>>
>> & " WHERE intTableTypeId = 3"
>>
>> Set rsFact = CurrentDb.OpenRecordset(gSQL, dbOpenSnapshot)
>>
>> With rsFact
>>
>> .MoveFirst
>>
>> wFactCount = 0
>>
>> Do Until .EOF
>>
>> wFactCount = wFactCount + 1
>>
>> Set ExlWS = ExlWB.Sheets(wFactCount)
>>
>> ExlWB.Sheets(wFactCount).Name = rsFact!strTableName
>>
>> ..
>>
>> ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW,
>> BoxH).Select
>>
>> With Selection
>>
>> .Name = rsFact!strTableName
>>
>> .Characters.Text = rsFact!strTableName
>>
>> With .ShapeRange
>>
>> With .Fill
>>
>> .Visible = True
>>
>> .Solid
>>
>> .ForeColor.SchemeColor = 26
>>
>> .Transparency = 0#
>>
>> End With
>>
>> With .Line
>>
>> .Weight = 0.75
>>
>> .DashStyle = msoLineSolid
>>
>> .Style = msoLineSingle
>>
>> .Transparency = 0#
>>
>> .Visible = msoTrue
>>
>> .ForeColor.SchemeColor = 64
>>
>> .BackColor.RGB = RGB(255, 255, 255)
>>
>> End With
>>
>> .Shadow.Type = msoShadow14
>>
>> .TextFrame.MarginLeft = 0#
>>
>> .TextFrame.MarginRight = 0#
>>
>> End With
>>
>> .HorizontalAlignment = xlCenter
>>
>> .VerticalAlignment = xlCenter
>>
>> With .Font
>>
>> .FontStyle = "ARIAL"
>>
>> .Size = 12
>>
>> .ColorIndex = xlAutomatic
>>
>> End With
>>
>> End With
>>
>>
>> '-----------------------------------------------------------------------
>> Next fact
>>
>> .MoveNext
>>
>> Loop
>>
>> .Close
>>
>> End With
>>



Avatar
Wendake
OK, tu as raison et en effet j'ai passé l'obstacle « Selection », maintenant
je n'arrive pas à quitter le processus. À la fin j'ai utilisé les mêmes
instruction d'un autre programme qui fonctionne.

With ExlApp
.DisplayAlerts = False
.ActiveWorkbook.Save
.DisplayAlerts = True
.Workbooks.Close
.Quit
End With
Set ExlWS = Nothing
Set ExlWB = Nothing
Set ExlApp = Nothing

Salut
"Michel__D" a écrit dans le message de
news: gjsrmc$gkv$
Bonjour,

Exécute en pas en pas, tu verras bien, mais je dois pas être loin de la
vérité.

PS:La propriété "Selection" se réfère à l'objet Application (Excel) et ce
n'est
pas moi qui l'affirme mais l'aide, d'ailleurs tu ferais bien d'y jeter un
oeil.


"Wendake" a écrit dans le message de
news:
Mais alors ne devrait pas fonctionner aussi avec la première lecture du
recordset, tandis que ça fonctionne parfaitement. En plus « AddShape est
pour une worksheet et non pour un Application



ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW, BoxH).Select



Salut.

"Michel__D" a écrit dans le message
de
news:
> Bonjour,
>
> Le problème est à ce niveau :
>
> With Selection
>
> car lorsque tu es sous Excel la propriété s'applique de manière
> implicite
> à l'objet Application (Excel), mais ici tu es sous Access il faut donc
> lui
> fournir explicitement l'objet auquel il se réfère à savoir un objet
> Application (Excel), cela devrait donner un truc de ce genre :
>
> With ExlApp.Selection
>
>
> Wendake a écrit :
>> Encore moi.
>>
>> J'ai deux loop de lectures un dans l'autre en relation. Quand je fais
>> la
>> première lecture du premier recordset, tout est correct. La relation
>> avec
>> le deuxième recordset fonctionne régulièrement et je peux dessiner mon
>> premier schéma.
>>
>> Quand je passe à la deuxième lecture du premier recordset j'arrive à
>> renommer la feuille (ExlWB.Sheets(wFactCount).Name >> >> rsFact!strTableName), à ajouter le rectangle
>> (AddShape(msoShapeRectangle,.), lui donner un nom, mais quand j'arrive
>> à
>> « With .ShapeRange » j'ai l'erreur suivant :
>>
>> Propriété ou méthode non gérée par cet objet
>>
>> Voila le code et merci:
>>
>>
>>
>>
>>
>> Set db = CurrentDb
>>
>> gSQL = "SELECT intTableId, strTableName, strDisplayName" _
>>
>> & " FROM tblTable" _
>>
>> & " WHERE intTableTypeId = 3"
>>
>> Set rsFact = CurrentDb.OpenRecordset(gSQL, dbOpenSnapshot)
>>
>> With rsFact
>>
>> .MoveFirst
>>
>> wFactCount = 0
>>
>> Do Until .EOF
>>
>> wFactCount = wFactCount + 1
>>
>> Set ExlWS = ExlWB.Sheets(wFactCount)
>>
>> ExlWB.Sheets(wFactCount).Name = rsFact!strTableName
>>
>> ..
>>
>> ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW,
>> BoxH).Select
>>
>> With Selection
>>
>> .Name = rsFact!strTableName
>>
>> .Characters.Text = rsFact!strTableName
>>
>> With .ShapeRange
>>
>> With .Fill
>>
>> .Visible = True
>>
>> .Solid
>>
>> .ForeColor.SchemeColor = 26
>>
>> .Transparency = 0#
>>
>> End With
>>
>> With .Line
>>
>> .Weight = 0.75
>>
>> .DashStyle = msoLineSolid
>>
>> .Style = msoLineSingle
>>
>> .Transparency = 0#
>>
>> .Visible = msoTrue
>>
>> .ForeColor.SchemeColor = 64
>>
>> .BackColor.RGB = RGB(255, 255, 255)
>>
>> End With
>>
>> .Shadow.Type = msoShadow14
>>
>> .TextFrame.MarginLeft = 0#
>>
>> .TextFrame.MarginRight = 0#
>>
>> End With
>>
>> .HorizontalAlignment = xlCenter
>>
>> .VerticalAlignment = xlCenter
>>
>> With .Font
>>
>> .FontStyle = "ARIAL"
>>
>> .Size = 12
>>
>> .ColorIndex = xlAutomatic
>>
>> End With
>>
>> End With
>>
>>
>> '-----------------------------------------------------------------------
>> Next fact
>>
>> .MoveNext
>>
>> Loop
>>
>> .Close
>>
>> End With
>>






Avatar
Michel__D
re,

Il vaudrait mieux fermer individuellement chaque classeur.

For Each ExlWB In ExlApp.Workbooks
ExlWB.Close( False)
Next


"Wendake" a écrit dans le message de news:
OK, tu as raison et en effet j'ai passé l'obstacle « Selection », maintenant
je n'arrive pas à quitter le processus. À la fin j'ai utilisé les mêmes
instruction d'un autre programme qui fonctionne.

With ExlApp
.DisplayAlerts = False
.ActiveWorkbook.Save
.DisplayAlerts = True
.Workbooks.Close
.Quit
End With
Set ExlWS = Nothing
Set ExlWB = Nothing
Set ExlApp = Nothing

Salut
"Michel__D" a écrit dans le message de
news: gjsrmc$gkv$
> Bonjour,
>
> Exécute en pas en pas, tu verras bien, mais je dois pas être loin de la
> vérité.
>
> PS:La propriété "Selection" se réfère à l'objet Application (Excel) et ce
> n'est
> pas moi qui l'affirme mais l'aide, d'ailleurs tu ferais bien d'y jeter un
> oeil.
>
>
> "Wendake" a écrit dans le message de
> news:
>> Mais alors ne devrait pas fonctionner aussi avec la première lecture du
>> recordset, tandis que ça fonctionne parfaitement. En plus « AddShape est
>> pour une worksheet et non pour un Application
>>
>>
>>
>> ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW, BoxH).Select
>>
>>
>>
>> Salut.
>>
>> "Michel__D" a écrit dans le message
>> de
>> news:
>> > Bonjour,
>> >
>> > Le problème est à ce niveau :
>> >
>> > With Selection
>> >
>> > car lorsque tu es sous Excel la propriété s'applique de manière
>> > implicite
>> > à l'objet Application (Excel), mais ici tu es sous Access il faut donc
>> > lui
>> > fournir explicitement l'objet auquel il se réfère à savoir un objet
>> > Application (Excel), cela devrait donner un truc de ce genre :
>> >
>> > With ExlApp.Selection
>> >
>> >
>> > Wendake a écrit :
>> >> Encore moi.
>> >>
>> >> J'ai deux loop de lectures un dans l'autre en relation. Quand je fais
>> >> la
>> >> première lecture du premier recordset, tout est correct. La relation
>> >> avec
>> >> le deuxième recordset fonctionne régulièrement et je peux dessiner mon
>> >> premier schéma.
>> >>
>> >> Quand je passe à la deuxième lecture du premier recordset j'arrive à
>> >> renommer la feuille (ExlWB.Sheets(wFactCount).Name > >> >> rsFact!strTableName), à ajouter le rectangle
>> >> (AddShape(msoShapeRectangle,.), lui donner un nom, mais quand j'arrive
>> >> à
>> >> « With .ShapeRange » j'ai l'erreur suivant :
>> >>
>> >> Propriété ou méthode non gérée par cet objet
>> >>
>> >> Voila le code et merci:
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Set db = CurrentDb
>> >>
>> >> gSQL = "SELECT intTableId, strTableName, strDisplayName" _
>> >>
>> >> & " FROM tblTable" _
>> >>
>> >> & " WHERE intTableTypeId = 3"
>> >>
>> >> Set rsFact = CurrentDb.OpenRecordset(gSQL, dbOpenSnapshot)
>> >>
>> >> With rsFact
>> >>
>> >> .MoveFirst
>> >>
>> >> wFactCount = 0
>> >>
>> >> Do Until .EOF
>> >>
>> >> wFactCount = wFactCount + 1
>> >>
>> >> Set ExlWS = ExlWB.Sheets(wFactCount)
>> >>
>> >> ExlWB.Sheets(wFactCount).Name = rsFact!strTableName
>> >>
>> >> ..
>> >>
>> >> ExlWS.Shapes.AddShape(msoShapeRectangle, xc, yc, BoxW,
>> >> BoxH).Select
>> >>
>> >> With Selection
>> >>
>> >> .Name = rsFact!strTableName
>> >>
>> >> .Characters.Text = rsFact!strTableName
>> >>
>> >> With .ShapeRange
>> >>
>> >> With .Fill
>> >>
>> >> .Visible = True
>> >>
>> >> .Solid
>> >>
>> >> .ForeColor.SchemeColor = 26
>> >>
>> >> .Transparency = 0#
>> >>
>> >> End With
>> >>
>> >> With .Line
>> >>
>> >> .Weight = 0.75
>> >>
>> >> .DashStyle = msoLineSolid
>> >>
>> >> .Style = msoLineSingle
>> >>
>> >> .Transparency = 0#
>> >>
>> >> .Visible = msoTrue
>> >>
>> >> .ForeColor.SchemeColor = 64
>> >>
>> >> .BackColor.RGB = RGB(255, 255, 255)
>> >>
>> >> End With
>> >>
>> >> .Shadow.Type = msoShadow14
>> >>
>> >> .TextFrame.MarginLeft = 0#
>> >>
>> >> .TextFrame.MarginRight = 0#
>> >>
>> >> End With
>> >>
>> >> .HorizontalAlignment = xlCenter
>> >>
>> >> .VerticalAlignment = xlCenter
>> >>
>> >> With .Font
>> >>
>> >> .FontStyle = "ARIAL"
>> >>
>> >> .Size = 12
>> >>
>> >> .ColorIndex = xlAutomatic
>> >>
>> >> End With
>> >>
>> >> End With
>> >>
>> >>
>> >> '-----------------------------------------------------------------------
>> >> Next fact
>> >>
>> >> .MoveNext
>> >>
>> >> Loop
>> >>
>> >> .Close
>> >>
>> >> End With
>> >>
>>
>