Opening a Spreadsheet at a Specified Location Using a Button

The Open File command for a Button control opens a specified file. Doing so launches the application associated with the specified file and opens the file in the application. For example, if you specified a Microsoft Excel file (*.xls, *.xlsx or *.xlsm), GoldSim would launch Excel and open the file.

When opening a spreadsheet file, in some cases you may want to immediately jump to a specified location (sheet and cell range) when opening the file.  GoldSim provides specialized syntax to support this. The syntax is as follows:

Filename#sheetname!cellrange (e.g., Book1.xlsx#Sheet1!a1:c3)

The following points should be noted:

   The entire text can be wrapped in quotes.  This should be done if the filename or sheet name contain any spaces.

   For an Excel file, GoldSim will recognize extension .xls, .xlsx, or .xlsm.

   The filename can be specified as a relative or absolute path. Absolute filenames must start with the drive letter or be a UNC path (starting with “\\”). Relative paths can contain “.” and “..” as well as folder names (e.g., “.\..\DataFolder\file.xlsx”). Relative filenames with no path are assumed to refer to the folder in which the model file is located.

   # is the delimiter between the filename and the sheet name.  It is optional (you do not need to provide a sheet name).The sheet name is not case-sensitive.

   ! is the delimiter between the sheet name and the cell range.  It is optional (you do not need to provide a cell range). The cell range can refer to a single cell (e.g., A2) or a range (e.g., A1:A3).

Related Topics…