|
-
Jun 6th, 2006, 09:14 AM
#1
Thread Starter
New Member
Linking one spreadsheet to another
Hi all,
How do you link a spreadsheet in one workbook to a tab in another workbook, pass parameters and then manipulate data? I am a newbie, please help.
Thanks!
-
Jun 6th, 2006, 09:16 AM
#2
Re: Linking one spreadsheet to another
Through VB6 or through Excel itself?
-
Jun 6th, 2006, 09:17 AM
#3
Re: Linking one spreadsheet to another
You would reference the other sheet/cell in the formula of the cell.
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 
-
Jun 6th, 2006, 09:20 AM
#4
Thread Starter
New Member
Re: Linking one spreadsheet to another
I am trying to do this in VB
-
Jun 6th, 2006, 09:21 AM
#5
Re: Linking one spreadsheet to another
What code have you written so far?
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 
-
Jun 6th, 2006, 09:28 AM
#6
Thread Starter
New Member
Re: Linking one spreadsheet to another
Unfortunately, i trashed out the code i wrote yesterday and i am starting afresh today.
Is it easier to do this in excel than in VB?
-
Jun 6th, 2006, 09:39 AM
#7
Re: Linking one spreadsheet to another
Ok heres the formula part in vb 6 code.
VB Code:
[i]ActiveCell[/i].Formula = Sheet2.Cells(1, 1).Value
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 
-
Jun 6th, 2006, 11:20 AM
#8
Thread Starter
New Member
Re: Linking one spreadsheet to another
Thanks for the suggestion . I tried that but could not get what I wanted. I have two separate excel work books. One for the user and the other for administrator. I am trying to create the user application in such a way that when the users login, what they see in the drop down list which is limited to their logon information. Second, when the select a branch from the drop down list and click the update button, then the update function will call the admin portion of the other workbook , perform the calculations based on the branch selected by the user in the user application and then paste the results in the user tab.
Can you please help?
-
Jun 6th, 2006, 11:24 AM
#9
Re: Linking one spreadsheet to another
A vb 6 form, correct?
If so then its a coding issue and not an Excel issue.
You would be populating your vb6 combo with info from either one or two of the books. So you would open each depending upon the users login.
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 
-
Jun 6th, 2006, 01:33 PM
#10
Thread Starter
New Member
Re: Linking one spreadsheet to another
Hi,
I am trying to pass the username & password to the second workbook.
The code below opens the second workbook but prompts the user for the user name & password. Please help?
Public Sub update_ws(wb)
'Dim AppWb As Application
'Set AppWb = Application.Workbooks.Open("Z:\AcctngBranchBudgets\Branch Profitability Model Update\BranchProfitabilityAdmin.xls")
'AppWb.Visible = True
Dim XLWb As Workbook
Set XLWb = Workbooks.Open("Z:\AcctngBranchBudgets\Branch Profitability Model Update\BranchProfitabilityAdmin.xls")
Dim XLSheet As Worksheet
Set XLSheet = XLWb.Sheets(4)
Dim XLRange As Range
Set XLRange = XLSheet.Range("a1")
XLRange.Value2 = 1
'XLWb.Close
End Sub
-
Jun 6th, 2006, 01:45 PM
#11
Re: Linking one spreadsheet to another
This looks like your doing this in Excels 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 
-
Jun 6th, 2006, 01:47 PM
#12
Re: Linking one spreadsheet to another
There is no UserName option. Only a password option.
VB Code:
Set XLWb = Workbooks.Open(Filename:="Z:\AcctngBranchBudgets\Branch Profitability Model Update\BranchProfitabilityAdmin.xls", Password:="meow")
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 
-
Jun 6th, 2006, 02:17 PM
#13
Thread Starter
New Member
Re: Linking one spreadsheet to another
Yes, i am doing it in excel VBA
-
Jun 6th, 2006, 02:43 PM
#14
Thread Starter
New Member
Re: Linking one spreadsheet to another
I have two loin forms when the application opens. The first login form is for the app and the second for the database. How do i by pass both logins?
-
Jun 6th, 2006, 02:48 PM
#15
Re: Linking one spreadsheet to another
-
Jun 6th, 2006, 03:30 PM
#16
Re: Linking one spreadsheet to another
You could just use the same login info for both so the userform login is only presented once.
It would be allot easier to set an Excel password so it can be passed when opening the file. Then for admin access you could supply the login userform.
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 
-
Jun 6th, 2006, 06:16 PM
#17
Thread Starter
New Member
Re: Linking one spreadsheet to another
Hi there,
I have adapted a piece of code to allow users to login into the database. I have two types of users, that of student and that of admin. If the admin logs in I want them to be taken to a different form than ordinary users.
Here is the code i have so far
Code:
Private Sub Login_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboUser) Or Me.cboUser = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboUser.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblUsers to see if this
'matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "Users", "[UserID]=" & Me.cboUser.Value) Then
UserID = Me.cboUser.Value
If Me.cboUser = AdminID Then
DoCmd.OpenForm "AdminForm"
Else
DoCmd.OpenForm "Studentform"
End If - My attempt at trying to get them to go to different forms!
'Close logon form and open splash screen
'DoCmd.Close acForm, "frmLogn", acSaveNo
'DoCmd.OpenForm "Questions" Just a test to see if it would open a form
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
the problem is that I can get the code to go to one form, but it will always be the same, no matter who logs in admin or student. I want them to go to different forms.
Code:
If Me.txtPassword.Value = DLookup("Password", "Users", "[UserID]=" & Me.cboUser.Value) Then
UserID = Me.cboUser.Value
If Me.cboUser = AdminID Then
DoCmd.OpenForm "AdminForm"
Else
DoCmd.OpenForm "Studentform"
End If - My attempt at trying to get them to go to different forms!
The above code doesnt work - I think the logic is correct but im not sure what syntax to use.. Basically if Admin logs in, load admin form, else load student form. Hope that explains better!
Any help would be much appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|