I am trying to automate the creation of file names when I open and close an excel file so I can apply the code to many files instead of 1. I am using access and excel 2003. Currently I am using the following code to open an excel template. The original code works when I try and substitute strings within the file commands that's where I run into trouble. In the current code section when I hover over strUCI I see strUCI instead of what is in the variable.
Code:
'original code
With goXL
.Workbooks.Open FileName:="Z:\Adhoc projects\ZZZ\ZZZ_CapsuleEcho_Sep2012.xlt"
'Select Sheetname for information to go into.
.Sheets("ZZZ_Capsule Echo").Select
End With
'Current code
Dim strCurMonth As String
Dim strUCI As String
Dim strSaveFile As String
Dim strCName As String
Dim strFileLoc As String
With goXL
strCName = strUCI
strFileLoc = "Z:\Adhoc projects\strCName"
strSaveFile = "\strUCI\strUCI & _ & CapsuleEcho_" & (strCurMon) & ".xlt"
.Workbooks.Open FileName:=strFileLoc & strSaveFile
'Select Sheetname for information to go into.
.Sheets("ZZZ_Capsule Echo").Select
End With