rpunger1957

New Member
Joined
Sep 27, 2018
Messages
2
I am trying to read cell A1:A1500 on closed workbook C:\TimeCards\CivlianAlphaRoster.xls for loop info on open workbook to save as filename. I have tried for 3 days with no results.

Can someone help to see what I may be doing wrong?

Mega thanks for any help.

Short VBA is below.


Sub TimeCards()
Dim Path As String
Dim DirArray As Variant


' Read CivilianAlpha Roster Cell A
' Read CivilianAlpha Roster Cell A
' Read CivilianAlpha Roster Cell A



strPath = "C:\TimeCards"
strFile = "CivilianAlphaRoster.xls"
strSheet = "Sheet1"
strRng = Range("A1").Address(1, 1, xlR1C1)

strRef = "'" & strPath & "[" & strFile & "]" & strSheet & "'!" & strRng

DirArray = Range("A1:A1500").Value

Do Until IsEmpty(ActiveCell)

Path = ExecuteExcel4Macro(strRef)
Application.Wait (Now + TimeValue("00:00:03"))
ActiveCell.Offset(0, 0).Select
Application.Wait (Now + TimeValue("00:00:03"))
ActiveCell.Offset(0, 0).Select

Application.Wait (Now + TimeValue("00:00:03"))
Windows("CivilianAlphaRoster.xls").Activate

PasteMe = (ActiveCell)
Workbooks.Open ThisWorkbook.Path & "" & "2019 AFRC_Timesheet v54.xls"
Windows("2019 AFRC_Timesheet v54.xls").Activate
Application.WindowState = xlMaximized
ActiveWindow.WindowState = xlMaximized
Application.Wait (Now + TimeValue("00:00:3"))
Windows("2019 AFRC_Timesheet v54.xls").Activate
ActiveWorkbook.SaveAs Filename:= _
"C:\TimeCards" & PasteMe & " 2019 AFRC_Timesheet v54.xls", FileFormat:=xlExcel8 _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=True

Application.Wait (Now + TimeValue("00:00:3"))
Windows("CivilianAlphaRoster.xls").Activate
ActiveCell.Offset(1, 0).Select
A = A + 1
Loop
End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,215,222
Messages
6,123,706
Members
449,118
Latest member
MichealRed

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