dnickelson
Board Regular
- Joined
- Oct 30, 2003
- Messages
- 118
Getting stumped. Trying to play with WHScripting to access some of the excel features so I'm working with the objects in VBA first (so I at least have a starting space) but can't figure out how (or if it's possible) to access the Userforms in another workbook directly, keep getting errors. Various error messages possibly related to how I'm accessing the objects at all. I'm hoping to do various things with the userform (show\hide, grab variables, validation, etc), but stuck on the very first thing which is access it in the first place. Looked through the topics, but so much about userforms, can't filter it down to any external references. Rather not have to have the original workbook do all the work, but do I have a choice?
haven't necessarily thought it all the way through, how to keep track of what's doing what, but the idea is that I can have a whscript file a user can open which will bring up userforms I've created in various workbooks, maybe word docs, etc. the main point is a point of reference external to any of the individual vba applications that can (hopefully) directly utilize some of the vba stuff I've already done.
maybe a little ambitious for not even being able to figure out this first part, but....
Code:
Sub something()
Dim wb As Workbook
Application.Workbooks.Open ("c:\copy of text.xls")
Workbooks("copy of text.xls").UserForms.Count
End Sub
'Object doesn't support this property or method
Sub somethingelse()
Dim wb As Workbook
Application.Workbooks.Open ("c:\copy of text.xls")
With Workbooks("copy of text.xls")
userform1.Show
End With
End Sub
'object required
Sub somethingother()
Dim wb As Workbook
Application.Workbooks.Open ("c:\copy of text.xls")
With Workbooks("copy of text.xls")
UserForms(1).Show
End With
End Sub
'subscript out of range
haven't necessarily thought it all the way through, how to keep track of what's doing what, but the idea is that I can have a whscript file a user can open which will bring up userforms I've created in various workbooks, maybe word docs, etc. the main point is a point of reference external to any of the individual vba applications that can (hopefully) directly utilize some of the vba stuff I've already done.
maybe a little ambitious for not even being able to figure out this first part, but....