How to Reference Excel Constant from Access

dillard720

New Member
Joined
Oct 12, 2011
Messages
11
I am stuck and would appreciate any help that can assist me.


I have an access database in whcih I upload data from different excel spreadsheets. In access the user clicks a button which a browsing window opens and they select the file they want to upload. The code then continues the upload process. In each of the available spreadsheets i have a constant which has the template type (Public Const TEMPLATE_NAME = "SCO Proposal"
Public Const TEMPLATE_VERSION = "2.62"). From Access, when the browsed template is open, I need to look up the TEMPLATE_NAME in the excel file in order to know which upload code to run.

Something like this:


Private Sub btn_Attachfile_Click()

Dim rs As DAO.Recordset
Dim appExcel As Excel.Application
Dim wb As Excel.Workbook


DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSaveRecord

'browse for upload file
sBrowsingWindow

Set appExcel = CreateObject("Excel.application")
Set wb = appExcel.Workbooks.Open(gsFilePath, , ReadOnly = True)

'Chcek TEMPLATE_NAME here

Select Case TEMPLATE_NAME

Case "SCO Proposal"
upload instructions
Case "ISCM"
upload instructions
Case "IFT"
upload instructions
Case Else
End Select


My issue: I don't know how to look up TEMPLATE_NAME in excel from my access database.

Help, please!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top