我想阻止Excel VBA检查是否存在过程

时间:2016-12-28 00:34:05

标签: vba excel-vba excel

是否可以阻止Excel VBA在运行之前检查程序是否存在。

我想运行这样的程序:

VBProj.VBComponents.Import "C:\somefile.bas"  
Call sub_which_only_exists_after_the_above_import()

但我得到以下内容:
“编译错误
 子或函数未定义“ 并且“呼叫”行突出显示。

我搜索了谷歌但没有发现任何有用的信息。

提前感谢您的帮助。 干杯 杰夫。

1 个答案:

答案 0 :(得分:2)

试试这个:

import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

import static com.example.emilythacker.chorelist.R.id.textView_ID;



class CustomAdapter extends ArrayAdapter{

    public CustomAdapter(Context context, ArrayList choreText) {
        super(context, R.layout.custon_listview_row, choreText);
    }

    @NonNull
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater myInflater = LayoutInflater.from(getContext());
        View customView = myInflater.inflate(R.layout.custon_listview_row, parent, false);


        ImageButton imageButton = (ImageButton) customView.findViewById(R.id.imageButton_ID);
        final TextView textView = (TextView) customView.findViewById(textView_ID);





        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //what happens when textView is clicked
                AlertDialog alertDialog = new AlertDialog.Builder(getContext()).create();
                final EditText input = new EditText(getContext());
                input.setHint("hint");
                alertDialog.setView(input);
                alertDialog.setTitle("Set Chore");
                alertDialog.setMessage("Alert message to be shown");
                alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {

                                //this will set text to "hello" only if user does not enter anything into input
                                //textView.setText("hello");

                                //this also will only work if there is no input entered into input...wich will change textView into empty space
                                textView.setText(input.getText().toString());




                                //works the same with or without dialog.dismiss();
                                dialog.dismiss();
                            }
                        });
                alertDialog.show();

            }
        });



        imageButton.setImageResource(R.drawable.clock);


        return customView;
    }
}