Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1594 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  passer un userform en variable

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

passer un userform en variable

n°2047232
aidevba
Posté le 07-01-2011 à 13:51:49  profilanswer
 

Bonjour le forum,
 
J'ai posté un message ce matin à propos des userforms, si quelqu'un en a besoin...
 
J'ai une nouvelle question, comment fait on pour passer un userform en tant que variable à une procédure?
 
Voilà mon code:
 
Voici ma procédure qui met les userform en plein écran et qui ajuste les controls du userform
 
Sub taille_USF(ByVal oUF As UserForm)
 
Dim ctl As Control
Dim ratow As String
Dim ratioh As String
 
ratiow = Application.Width / oUF.Width
ratioh = Application.Height / oUF.Height
oUF.Left = 0
oUF.Top = 0
oUF.Width = Application.Width
oUF.Height = Application.Height
 
For Each ctl In oUF.Controls
  ctl.Left = ctl.Left * ratiow
  ctl.Top = ctl.Top * ratioh
  ctl.Width = ctl.Width * ratiow
  ctl.Height = ctl.Height * ratioh
  ctl.FontSize = ctl.FontSize * ratioh
Next
 
End Sub
 
Voici mon appel de ma procédure mais j'ai une erreur de type "438" Propriété ou methode non géré par l'objet
 
call taille_USF (Userform1)
 
Quelqu'un à une idée SVP?

mood
Publicité
Posté le 07-01-2011 à 13:51:49  profilanswer
 

n°2047398
Xxxaaavvv
Posté le 07-01-2011 à 16:48:19  profilanswer
 

aidevba a écrit :

Bonjour le forum,
 
J'ai posté un message ce matin à propos des userforms, si quelqu'un en a besoin...
 
J'ai une nouvelle question, comment fait on pour passer un userform en tant que variable à une procédure?
 
Voilà mon code:
 
Voici ma procédure qui met les userform en plein écran et qui ajuste les controls du userform
 
Sub taille_USF(ByVal oUF As UserForm)
 
Dim ctl As Control
Dim ratow As String
Dim ratioh As String
 
ratiow = Application.Width / oUF.Width
ratioh = Application.Height / oUF.Height
oUF.Left = 0
oUF.Top = 0
oUF.Width = Application.Width
oUF.Height = Application.Height
 
For Each ctl In oUF.Controls
  ctl.Left = ctl.Left * ratiow
  ctl.Top = ctl.Top * ratioh
  ctl.Width = ctl.Width * ratiow
  ctl.Height = ctl.Height * ratioh
  ctl.FontSize = ctl.FontSize * ratioh
Next
 
End Sub
 
Voici mon appel de ma procédure mais j'ai une erreur de type "438" Propriété ou methode non géré par l'objet
 
call taille_USF (Userform1)
 
Quelqu'un à une idée SVP?


 
Un userform c'est un objet... normalement fonctionner avec "byval" me parait tordu...
Sub taille_USF(ByRef oUF As UserForm)
 
 
a première vue la procédure a l'air correcte...
sauf que le type d'objet UserForm n'as pas l'air de gérer "Left"; "Top", etc...
 
et je ne sais pas pas ou tu travaille (Excel ? Access ? etc) ...
 

n°2047457
kiki29
Posté le 07-01-2011 à 19:14:58  profilanswer
 

Salut, voir peut-être http://support.microsoft.com/kb/157609/en-us et http://silkyroad.developpez.com/VBA/UserForm/


Message édité par kiki29 le 07-01-2011 à 19:27:52

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  passer un userform en variable

 

Sujets relatifs
PaperVision3D : passer de la 2d a la 3d = problème de coordonnées :-/Utilisation de la variable $_SESSION
Inclure une variable php dans du javascriptsauvegarde variable as3
Probleme de variable (corrigé)Creer fichier avec le nom d'une variable
Supprimer les espaces dans une variable[PERL] remplacement caractères dans une variable.
Submit Image et transmission de variable.[VBA] Passer une variable d'un userform à un autre
Plus de sujets relatifs à : passer un userform en variable


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR