Private Sub Userform Activate

👉🏻👉🏻👉🏻 ALL INFORMATION CLICK HERE 👈🏻👈🏻👈🏻
VBForums
Visual Basic
Office Development
About Private Sub UserForm_Activate()
Thread Tools
Show Printable Version
Display
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
discCPU
View Profile
View Forum Posts
and other VB enthusiasts, i need your help.
i'm using visual basic 6.3 : Excel>Tools>macro>Visual basic Editor
i'm creating a user interface. However i have trouble putting my ideas into codes.
When i run my program, i want it to Prompt the user for its name.
theName typed will display at the top-left of the program. [ i think using label right? ] if the person click on enter without typing anything, i want it to show error msg.
and saving the file as "theName".xls if there's another file of the same name, i dont want it replaced. eg. [ theName1.xls ]
i understand it got to do with this?
Private Sub UserForm_Activate()
I'm pretty clueless now.
Please assist me. I'll be deeply appreciated.
Yes.i developing this for patients going for hand Rehabilitation.
Once i'm familiar with this programming lang, i'll contribute to the Forum
Last edited by discCPU; Apr 4th, 2007 at 03:10 AM .
Macka007
View Profile
View Forum Posts
returnstring=InputBox("Enter your name")
discCPU
View Profile
View Forum Posts
returnstring="" msgbox ="Please enter your name"
Macka007
View Profile
View Forum Posts
returnstring=InputBox("Enter your name")
returnstring=InputBox("Enter your name")
returnstring=InputBox("Enter your name")
returnstring=InputBox("Enter your name")
RobDog888
View Profile
View Forum Posts
Visit Homepage
Since this is Excel VBA code I will move the thread to our Office Development forum. Also, Welcome to the Forums.
Moved
Where are you doing the save from?
Ps, there is no "Form_Load" event in VBA.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
oh VBA. ok. i'll take note of it. thanks for the welcome RobDog888 .
i like this forum. fast response with members of vast knowledge of VB.
i hope i'll be like them one day.
i'll be trying out the code macka007 .
how abt saving the file?
RobDog888
View Profile
View Forum Posts
Visit Homepage
You mean to programmatically save the file and prompt if it already exists?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Macka007
View Profile
View Forum Posts
Open "C:\Example.txt" for output as #1 'create a txt file, or if one exist, overwrite it
print #1, "This is a test!" 'Write this out to the text file
print #1, "it is very simple to save data to txt files" 'Write out more data
Dim InputString as String 'make a variable which is a string
Open "C:\Example.txt" for input as #1 'Open the file, note we are inputing it
do while not eof(1) 'eof stands for end of file, we will continue the loop until we reach the last line of the file
InputString= line input #1 'input one line and store in the variable
msgbox inputstring 'change this to whatever you want to do with the data
loop 'go to the beggining of the loop
Last edited by Macka007; Apr 4th, 2007 at 04:08 AM .
RobDog888
View Profile
View Forum Posts
Visit Homepage
Text file? I thought this was an xls file?
If so, then here is how:
ThisWorkbook.SaveAs Filename:="C:\SomeFile.xls", FileFormat:=xlExcel8
It will automatically prompt for overwrite aceptance if the file already exists.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
Text file? I thought this was an xls file?
If so, then here is how:
ThisWorkbook.SaveAs Filename:="C:\SomeFile.xls", FileFormat:=xlExcel8
It will automatically prompt for overwrite aceptance if the file already exists.
RobDog888
View Profile
View Forum Posts
Visit Homepage
'Create some different file name.
ThisWorkbook.SaveAs FileName:="C:\SomeFolder\MyFile_" & Format(Now,"YYYYMMDD_HhNnSs") & ".xls", FileFormat:=xlExcel8
'Save but as what? Atutomatically give it a default file and path or prompt them for it?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
'Create some different file name.
ThisWorkbook.SaveAs FileName:="C:\SomeFolder\MyFile_" & Format(Now,"YYYYMMDD_HhNnSs") & ".xls", FileFormat:=xlExcel8
'Save but as what? Atutomatically give it a default file and path or prompt them for it?
filename = Split(CStr(Date), "/")(0) + Split(CStr(Date), "/")(1) + Split(CStr(Date), "/")(2)
' to auto save the data recorded in excel after pressing stop
Open "C:\" + filename + ".txt" For Output As #1
For q = 1 To CInt(TextBox3.Text)
Print #1, CStr(ActiveSheet.Cells(q, 1)) + "," + CStr(ActiveSheet.Cells(q, 2)) & vbCrLf
AskAgain: ReturnString = InputBox("Enter your name")
Last edited by discCPU; Apr 4th, 2007 at 09:55 PM .
RobDog888
View Profile
View Forum Posts
Visit Homepage
Its was just for the formatting of the filename mostly. Adding a .GetSaveAsDialog function wil be what you want to create a Save As dialog.
The other code is just writting out a textfile (of comma separated values) of some range of cells with a date format. But if they save twice within one day it will be duplicated.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
Its was just for the formatting of the filename mostly. Adding a .GetSaveAsDialog function wil be what you want to create a Save As dialog.
The other code is just writting out a textfile (of comma separated values) of some range of cells with a date format. But if they save twice within one day it will be duplicated.
RobDog888
View Profile
View Forum Posts
Visit Homepage
strTest = Application.GetSaveAsFilename(InitialFileName:="Test.xls", FileFilter:="Excel Workbooks (*.xls), *.xls", FilterIndex:="1", Title:="My Dialog")
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
strTest = Application.GetSaveAsFilename(InitialFileName:="Test.xls", FileFilter:="Excel Workbooks (*.xls), *.xls", FilterIndex:="1", Title:="My Dialog")
ActiveSheet.Cells(i, j) = ""
ActiveSheet.Cells(1, 1) = "Ch1(uV)" 'name the cell as Ch1(uV)
ActiveSheet.Cells(1, 2) = "Ch2(Deg)"
UltimaSerial.Device = Val(List1.Text) 'Select the device
UltimaSerial.CommPort = Val(Combo1.Text) 'COM port
UltimaSerial.ChannelCount = 2 'enable only two channel
UltimaSerial.MaskOutDigitalBits = True 'Not allowing digital inputs to be embeded in analog channel
UltimaSerial.SampleRate = Val(TextBox1.Text)
UltimaSerial.AcquisitionMode = NoCondition 'trigger method
Label4.Caption = "Serial Number: " + UltimaSerial.SerialNumber ' display the serial number
UltimaSerial.Stop 'stop the program
IeTimer3.Enabled = False ' stop the IeTimer3
filename = Split(CStr(Date), "/")(0) + Split(CStr(Date), "/")(1) + Split(CStr(Date), "/")(2)
' to auto save the data recorded in excel after pressing stop
Open "C:\" + filename + ".txt" For Output As #1
For q = 1 To CInt(TextBox3.Text)
Print #1, CStr(ActiveSheet.Cells(q, 1)) + "," + CStr(ActiveSheet.Cells(q, 2)) & vbCrLf
RobDog888
View Profile
View Forum Posts
Visit Homepage
Well you have a start button and a stop button. Where is it that the save as dialog box should be presented?
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
RobDog888
View Profile
View Forum Posts
Visit Homepage
Just replace the code from #8 in your code witht he 3 lines of code I gave you.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
i replaced line 38 with the code you gave me.
the dialog came. gd
but no excel file was actually saved.
RobDog888
View Profile
View Forum Posts
Visit Homepage
No, because you need to write the saveas code lik eI posted earlier. Post #11
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
discCPU
View Profile
View Forum Posts
i'm pretty confused. where to put t
https://www.vbforums.com/showthread.php?461429-About-Private-Sub-UserForm_Activate()
https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/activate-deactivate-events
Horny Partner
Black Hole Spy New
Horse Cock Zoo Porn
About Private Sub UserForm_Activate()-VBForums
Activate, Deactivate events (Visual Basic for Applications ...
Private Sub UserForm_Activate() — Студопедия.Нет
Private Sub UserForm_Activate() — Студопедия
UserForm_Activate - Google Search
Excel VBA ユーザーフォームのActivateイベント アクティブに …
Заставка при открытии книги Excel
Utiliser les UserForm en VBA Excel - Developpez.com
Excel VBA ユーザーフォームのイベント
Private Sub Userform Activate






















































































