hellfire45
Active Member
- Joined
- Jun 7, 2014
- Messages
- 464
Hi guys so I have a module that is crashing excel every time and I don't know why. I will paste it below.
This path does not have two string variables declared; destinationpath and sourcepath
When I try to add the declarations (as seen below), then press f8 to step through the module, the workbook crashes.
The module is at it size limit and I can't see why.
I'm at a loss. Any ideas? Thanks!
This path does not have two string variables declared; destinationpath and sourcepath
When I try to add the declarations (as seen below), then press f8 to step through the module, the workbook crashes.
The module is at it size limit and I can't see why.
I'm at a loss. Any ideas? Thanks!
Code:
dim destinationpath as string
dim sourcepath as string
Code:
Option Explicit
Sub build_template()
Dim fso As Object
Dim strTargetFile As String
Dim strFolder As String: strFolder = "I:\ASM\All\CRT\Reporting\In Consolidation Process\Reports\"
Dim strFileSpec As String: strFileSpec = strFolder & "*.*"
Dim strFileName As String
Dim destinationpath As String
Set fso = CreateObject("Scripting.FileSystemObject")
'sets the file path for key files
folderpath = "I:\ASM\All\CRT\Reporting\In Consolidation Process\Reports\"
'Builds folder directory with current date in report archive folder location seen below
If Dir("I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Dated Report Archive\" & Format(Date, "yyyy-mm-dd"), vbDirectory) = "" Then
MkDir ("I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Dated Report Archive\" & Format(Date, "yyyy-mm-dd") & "\")
End If
destinationpath = "I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Dated Report Archive\" & Format(Date, "yyyy-mm-dd") & "\"
SourcePath = "C:\Users\x\Desktop\y\Archive of XML\" & Format(Date, "yyyy-mm-dd") & "\"
strFileName = Dir(strFileSpec)
'big loop that processes the data from bout a dozen files and compile appends this data into "the hopper".
Do While strFileName <> ""
strExt = CreateObject("Scripting.FileSystemObject").GetExtensionName(strFileName)
End Sub