Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-18-2015, 05:05 AM
Vibov Vibov is offline Value of Combobox in other userform Windows 7 32bit Value of Combobox in other userform Office 2010 32bit
Novice
Value of Combobox in other userform
 
Join Date: Jan 2015
Posts: 8
Vibov is on a distinguished road
Default Value of Combobox in other userform

Hi

Do any one know how to use a comboxbox value from a userform in several userform?

I have set all to public but it don´t help me.



I want to use a value from a combobox in a Outlook message, but how?
Reply With Quote
  #2  
Old 11-18-2015, 05:43 AM
Debaser's Avatar
Debaser Debaser is offline Value of Combobox in other userform Windows 7 64bit Value of Combobox in other userform Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

If the userform is open, you can use userformname.comboboxname.Value to return the value. If it will not be open, you have to store the value in a public variable in a normal module.
Reply With Quote
  #3  
Old 11-18-2015, 06:15 AM
Vibov Vibov is offline Value of Combobox in other userform Windows 7 32bit Value of Combobox in other userform Office 2010 32bit
Novice
Value of Combobox in other userform
 
Join Date: Jan 2015
Posts: 8
Vibov is on a distinguished road
Default

I have tried to get the value from the combobox and put it in a variable but it alway turn out empty.

Public Sub CommandButton4_Click()
bodymailtext = Antal1 & Antal2 & antal5 & TEST1
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.To = "Martin.Vibov@peri.dk" ' "Martin.vibov@peri.dk"
.CC = "" ' Husk at ændre disse 2 (TO og CC), hvis der skal testet
.BCC = ""
.Subject = "Fremtidige udsmidninger "
.Body = bodymailtext
'"Hej Kim og Peter" & vbNewLine & vbNewLine & "Dette er hvad der forventes, at blive smidt ud" & vbNewLine & vbNewLine & _
"Vare" & vbTab & "Antal" & vbTab & "Sti til billeder" & vbTab & "Peri eller Kunde Scrot" & vbTab & "Total KG." & vbNewLine & _
Antal1 & vbTab & Abtal2 & vbTab & "Variabler skal ind her" & vbNewLine & _
"Med Venlig Hilsen" & vbNewLine & "PERI Logistik"
.Send
End With

Set OutlookMail = Nothing
Set OutlookApp = Nothing

Sheets("Dropdown").Select
Unload Me
End Sub


Public Sub CommandButton1_Click()
'Application.ScreenUpdating = False
strbruger = Environ("username")
Dato = Date
Dato1 = Dato

Dato1 = Format(Dato, "ww")
If Anden <> "" Then
Sheets("Scrap").Range("A3").Value = Anden
Sheets("Scrap").Range("B3").Value = AndenQTY
'Sheets("Scrap").Range("C3").Value = "X:\PERI skrot 2015\Peri skrot i ugere\" & Dato1 & "\"
With Worksheets("Scrap")
.Hyperlinks.Add Anchor:=.Range("C3"), _
Address:="X:\PERI skrot 2015\Peri skrot i ugere\" & Dato1 & "\"
End With

Sheets("Scrap").Range("D3").Value = strbruger
Sheets("Scrap").Range("E3").Value = Dato

If Kundescrott = True Then
Sheets("Scrap").Range("F3").Value = "Kunde Scrott"
Else
Sheets("Scrap").Range("F3").Value = "Peri Scrott"
End If


Sheets("Scrap").Select
Range("H3").Select

Sheets("Scrap").Select
Range("I3").Select
ActiveCell.FormulaR1C1 = "=LEFT(RC[-8],6)"
' ActiveCell.FormulaR1C1 = "=IF(R[]C[-1]="""","""",TODAY())" ' Denne er kun aktuel, hvis datoen ikke ændres sig når dokumentet åbnes

Range("J3").Select ' Denne og nedestående linje skal ændres, når jeg ved hvor Dejan ligger excel dokumentet
'ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],'C:\Users\vibov\Desktop\[Copy of 0243 article price list.xls]price list, Product Group'!R1C4:R65536C20,17,FALSE)"
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],'G:\Martin Vibov\Projekter\Scrap\[Copy of 0243 article price list.xls]price list, Product Group'!R1C4:R10000C20,4,FALSE)"
Range("K3").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-1]*RC[-9])"

Rows("3:3").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Else: End If


Sheets("Dropdown").Select
Unload Me
Dato = ""
Dato1 = ""
'Application.ScreenUpdating = False
End Sub
Reply With Quote
  #4  
Old 11-18-2015, 07:11 AM
Debaser's Avatar
Debaser Debaser is offline Value of Combobox in other userform Windows 7 64bit Value of Combobox in other userform Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Perhaps you could offer a clue as to how and where you have declared your variables and which is the reference to your combobox?
Reply With Quote
  #5  
Old 11-19-2015, 04:12 AM
Vibov Vibov is offline Value of Combobox in other userform Windows 7 32bit Value of Combobox in other userform Office 2010 32bit
Novice
Value of Combobox in other userform
 
Join Date: Jan 2015
Posts: 8
Vibov is on a distinguished road
Default Sorry

Sorry for not shared all, but i had some issue regarding add some Picture.
when i have put something together that make sence, then i will come back to you.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create UserForm ComboBox or ContentControl ptmuldoon Word VBA 11 01-17-2015 05:58 PM
VBA Code in a UserForm module to delete a Command Button which opens the userform Simoninparis Word VBA 2 09-21-2014 03:50 AM
Value of Combobox in other userform Is it possible to take an input from a UserForm in one document to a UserForm in a do BoringDavid Word VBA 5 05-09-2014 09:08 AM
ComboBox ListIndex = -1 even though it does NOT = -1 Joe Patrick Word VBA 0 08-03-2011 08:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:46 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft