我正在使用Excel 2013 vba。我有两种形式:frmMain和。在frmMain中,我只有一个带有代码UserForm1.show的cmd按钮,但是我无法打开UserForm1。
这是我的代码:
ggplot(make_qq(mtcars, "mpg")) +
geom_point(aes(x=qq, y=mpg, color=hp)) +
labs(x="Theoretical",y="Observed")
'Module1 Code ..
var fooContext = new FooContext(); //the context to check
var dbSets = fooContext.GetType().GetProperties()
.Where(p => p.PropertyType.IsGenericType
&& p.PropertyType.GetGenericTypeDefinition()
== typeof(DbSet<>)).ToArray(); //List Dbset<T>
var fooA = "fooA"; //the table to search
var dbSetProp = dbSets.SingleOrDefault(x=> x.PropertyType.GetGenericArguments()[0].Name == fooA);
if(dbSetProp != null) {
//fooContext has fooA table
var dbSet = fooContex.Set(dbSetProp.PropertyType.GetGenericArguments()[0]); // or via dbSetProp.GetValue(fooContext) as DbSet
dbSet.Add(fooARecord);
}
我的UserForm1的截图
UserForm1的代码......
Private Sub Workbook_Open()
Application.Visible = False 'This code hides the workbook
UserForm1.Show 'Brings the UserForm
End Sub
答案 0 :(得分:0)
从UserForm1
调用的Workbook_Open()
实例是否与从UserForm1
调用的frmMain
实例相同?
UserForm1
中将Module1
的实例声明为Public
。UserForm1
中声明frmMain
的表单级实例。如下所示。
'frmMain Code
Dim fUser As UserForm1
Private Sub CommandButton1_Click()
If fUser Is Nothing Then
fUser = New UserForm1
End If
fUser.Show
End Sub