I am fairly new with VB, any guidance is truly appreciated.
I am opening an Excel template and filling cells with values from an Access database. I want to be able to automate saving (SaveAs), and name the file with string values taken from 2 different cells.
How do I get these string values ?
This is what i have so far
Dim Rng1 As Range, Rng2 As Range
Dim StrCpy1 As Variant, StrCpy2 As Variant
Dim WrkSht As Worksheet
Dim WrkBk As Workbook
Set WrkBk = ActiveWorkbook
Set WrkSht = WrkBk.Sheets(2)
Set Rng1 = WrkSht.Range("A1"
Set Rng2 = WrkSht.Range("C1"
StrCpy1 =??????
StrCpy2=????
WrkBk.SaveAs FileName:="C:\My Documents\" & StrCpy1 & _
"_" & StrCpy2 & ".xls", _
FileFormat:=xlNormal
I am opening an Excel template and filling cells with values from an Access database. I want to be able to automate saving (SaveAs), and name the file with string values taken from 2 different cells.
How do I get these string values ?
This is what i have so far
Dim Rng1 As Range, Rng2 As Range
Dim StrCpy1 As Variant, StrCpy2 As Variant
Dim WrkSht As Worksheet
Dim WrkBk As Workbook
Set WrkBk = ActiveWorkbook
Set WrkSht = WrkBk.Sheets(2)
Set Rng1 = WrkSht.Range("A1"
Set Rng2 = WrkSht.Range("C1"
StrCpy1 =??????
StrCpy2=????
WrkBk.SaveAs FileName:="C:\My Documents\" & StrCpy1 & _
"_" & StrCpy2 & ".xls", _
FileFormat:=xlNormal