Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
First of all I have many issues and I am thankful for this website for
discussion purposes and any others - thanks all and thank you google groups. I am having trouble getting a userform to print what is in a textbox or I could even settle for it printing from an specific set of cells in a excel worksheet using the userform and a command button to intiate the process? I hope I am clear probably I am not I apolligize. I also could settle for being able to include hyperlinks into a userform after searching and excel sheet and retrieving data from specific cell on a worksheet. This is my example of trying to get the userform to print the value of textbox2 Private Sub CommandButton2_Click() UserForm1.texbox2.Text.PrintOut Copies:=1, Collate:=True End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i don't think you can just print the value.
you have to transfer the value onto a worksheet and then print that. Zigball wrote: This is my example of trying to get the userform to print the value of textbox2 Private Sub CommandButton2_Click() UserForm1.texbox2.Text.PrintOut Copies:=1, Collate:=True End Sub Private Sub CommandButton2_Click() Range("A1").Value = textbox2.Value ActiveWorksheet.PrintOut End Sub xxxxxxxxxxxxxxxxxxxx susan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for hyperlinks on a userform:
http://www.j-walk.com/ss/excel/tips/tip71.htm as John Walkenbach's site. If you want to print the userform including the textboxes: Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) 'Public Const VK_SNAPSHOT = &H2C Public Const VK_SNAPSHOT = 44 Public Const VK_LMENU = 164 Public Const KEYEVENTF_KEYUP = 2 Public Const KEYEVENTF_EXTENDEDKEY = 1 Sub Test() UserForm1.Show End Sub In the userform module: Private Sub CommandButton1_Click() ' keybd_event VK_SNAPSHOT, 0, 0, 0 DoEvents keybd_event VK_LMENU, 0, _ KEYEVENTF_EXTENDEDKEY, 0 ' key down keybd_event VK_SNAPSHOT, 0, _ KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, _ KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0 keybd_event VK_LMENU, 0, _ KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0 DoEvents Workbooks.Add Application.Wait Now + TimeValue("00:00:01") ActiveSheet.PasteSpecial Format:="Bitmap", _ Link:=False, DisplayAsIcon:=False ActiveSheet.Range("A1").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub -- Regards, Tom Ogilvy "Zigball" wrote: First of all I have many issues and I am thankful for this website for discussion purposes and any others - thanks all and thank you google groups. I am having trouble getting a userform to print what is in a textbox or I could even settle for it printing from an specific set of cells in a excel worksheet using the userform and a command button to intiate the process? I hope I am clear probably I am not I apolligize. I also could settle for being able to include hyperlinks into a userform after searching and excel sheet and retrieving data from specific cell on a worksheet. This is my example of trying to get the userform to print the value of textbox2 Private Sub CommandButton2_Click() UserForm1.texbox2.Text.PrintOut Copies:=1, Collate:=True End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank You Susan this was a great help!
Susan wrote: i don't think you can just print the value. you have to transfer the value onto a worksheet and then print that. Zigball wrote: This is my example of trying to get the userform to print the value of textbox2 Private Sub CommandButton2_Click() UserForm1.texbox2.Text.PrintOut Copies:=1, Collate:=True End Sub Private Sub CommandButton2_Click() Range("A1").Value = textbox2.Value ActiveWorksheet.PrintOut End Sub xxxxxxxxxxxxxxxxxxxx susan |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank You Tom I will try this, Thanks!
Tom Ogilvy wrote: for hyperlinks on a userform: http://www.j-walk.com/ss/excel/tips/tip71.htm as John Walkenbach's site. If you want to print the userform including the textboxes: Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) 'Public Const VK_SNAPSHOT = &H2C Public Const VK_SNAPSHOT = 44 Public Const VK_LMENU = 164 Public Const KEYEVENTF_KEYUP = 2 Public Const KEYEVENTF_EXTENDEDKEY = 1 Sub Test() UserForm1.Show End Sub In the userform module: Private Sub CommandButton1_Click() ' keybd_event VK_SNAPSHOT, 0, 0, 0 DoEvents keybd_event VK_LMENU, 0, _ KEYEVENTF_EXTENDEDKEY, 0 ' key down keybd_event VK_SNAPSHOT, 0, _ KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, _ KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0 keybd_event VK_LMENU, 0, _ KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0 DoEvents Workbooks.Add Application.Wait Now + TimeValue("00:00:01") ActiveSheet.PasteSpecial Format:="Bitmap", _ Link:=False, DisplayAsIcon:=False ActiveSheet.Range("A1").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub -- Regards, Tom Ogilvy "Zigball" wrote: First of all I have many issues and I am thankful for this website for discussion purposes and any others - thanks all and thank you google groups. I am having trouble getting a userform to print what is in a textbox or I could even settle for it printing from an specific set of cells in a excel worksheet using the userform and a command button to intiate the process? I hope I am clear probably I am not I apolligize. I also could settle for being able to include hyperlinks into a userform after searching and excel sheet and retrieving data from specific cell on a worksheet. This is my example of trying to get the userform to print the value of textbox2 Private Sub CommandButton2_Click() UserForm1.texbox2.Text.PrintOut Copies:=1, Collate:=True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Random Text in a userform textbox | Excel Programming | |||
Help with UserForm textbox code | Excel Programming | |||
Help with UserForm textbox code | Excel Programming | |||
Using The Text From A Textbox In A UserForm | Excel Programming | |||
Adding TextBox to UserForm via code | Excel Programming |