Open File Without Calling Filepath

后端 未结 5 1352
太阳男子
太阳男子 2021-02-05 15:04

I\'m using excel VBA. I want to press a button that opens another file directly without the effect of \"choosing file window\".

This is the current code:



        
5条回答
  •  时光说笑
    2021-02-05 15:54

    If the file name is fixed you can use the ActiveWorkbook.Path function to return the path of the current workbook:

    Dim FileName as string FileName = ActiveWorkbook.Path & "\myfile.xlsx

    Check if you need that extra slash character.

提交回复
热议问题