soultrappa
New Member
- Joined
- Dec 9, 2014
- Messages
- 1
Hi All,</SPAN>
I am trying to get a sign up sheet embedded onto the end of a powerpoint presentation. There are four textboxes - Forename, Surname, Email and network id that the user can enter information.</SPAN>
I need that information to populate cells in Excel for e.g the header line would be the same categories as the textboxes. I need the forname to populate say cell B1, surname B2, email B3 and network id B4.</SPAN>
If the B1 - B4 row is already populated then i need it to add a new row and populate in the new row. </SPAN>
I have had a little experience with visual studio but find that VBA is somewhat different. I thought i could just call the workbook - open it - minimise it then have the whole
</SPAN>
I am currently using the code below
</SPAN>
Unfortunately it will not open the workbook and i get an error message at the Thisworkbook.Activate stage – error is Run-time1004 Method’ThisWorkbook’ of object’_global’ failed. When i ctrl alt del i can see that excel has opened and there seems to be an invisible instance of a workbook that i cannot get focus off nor close.</SPAN>
Other info - as you can see from the coding i have a submit command button and some labels which will display the info to the user.</SPAN>
Any help sure would be appreciated and if you have the time a brief explanation as to why you have written the code (as apposed to heres some code try this).</SPAN>
Thanks in advance.</SPAN>
I am trying to get a sign up sheet embedded onto the end of a powerpoint presentation. There are four textboxes - Forename, Surname, Email and network id that the user can enter information.</SPAN>
I need that information to populate cells in Excel for e.g the header line would be the same categories as the textboxes. I need the forname to populate say cell B1, surname B2, email B3 and network id B4.</SPAN>
If the B1 - B4 row is already populated then i need it to add a new row and populate in the new row. </SPAN>
I have had a little experience with visual studio but find that VBA is somewhat different. I thought i could just call the workbook - open it - minimise it then have the whole
Code:
txt1.value = (file path to workbook), (worksheet), (create row), (cell).
I am currently using the code below
Code:
Sub Open_excel()
Dim wkb As Workbook
Set wkb = Workbooks.Open("C:\Users\jason.francis\Documents\DHREL.xlsx")
'Dim excel As excel.Application
'Set excel = CreateObject("excel.application")
'excel.Workbook.Open ("C:\Users\jason.francis\Documents\DHREL.xlsx")
End Sub
Public Sub Clear_form()
lblfname.Caption = ""
lblsname.Caption = ""
lblemai.Caption = ""
lblnuhid.Caption = ""
End Sub
Private Sub Submit_Click()
'remembers text in textboxes
Dim fname As String
Dim sname As String
Dim emai As String
Dim nuhid As String
'places text in textbox to memory
fname = Txtfname.Text
sname = Txtsname.Text
emai = Txtemai.Text
nuhid = Txtnuhid.Text
'adds text from txtbox to labels
lblfname.Caption = fname
lblsname.Caption = sname
lblemai.Caption = emai
lblnuhid.Caption = nuhid
Workbooks.Open ("C:\Users\jason.francis\Documents\DHREL.xlsx")
Workbook.Activate
ActiveWindow.WindowState = xlMinimized
'Workbooks.Open ("C:\Users\jason.francis\Documents\DHREL.xlsx")
'ThisWorkbook.Activate
End Sub
Unfortunately it will not open the workbook and i get an error message at the Thisworkbook.Activate stage – error is Run-time1004 Method’ThisWorkbook’ of object’_global’ failed. When i ctrl alt del i can see that excel has opened and there seems to be an invisible instance of a workbook that i cannot get focus off nor close.</SPAN>
Other info - as you can see from the coding i have a submit command button and some labels which will display the info to the user.</SPAN>
Any help sure would be appreciated and if you have the time a brief explanation as to why you have written the code (as apposed to heres some code try this).</SPAN>
Thanks in advance.</SPAN>