Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Dim path AS String
path = Environ("USERPROFILE") & "\Desktop\Download.csv"
Open in new window
Private Sub Command1_Click()
spec = 99 'Or any other unreasonably large number of your choice
For i = 0 To Access.CurrentProject.ImportExportSpecifications.Count - 1
If Access.CurrentProject.ImportExportSpecifications(i).Name = "Download" Then
spec = i
If spec = 99 Then
Call MsgBox("Critical Error. Import Specification Not Found. This process will now exit.", vbCritical)
strXML = Access.CurrentProject.ImportExportSpecifications(spec).XML
Dim strImportFile As String
strImportFile = Environ("USERPROFILE") & "\Desktop\Download.csv"
'Find the delimiters of the current path string
i = InStr(strXML, "ImportExportSpecification Path=")
If i = 0 Then i = InStr(strXML, "ImportExportSpecification Path = ")
'First double quote after that
i = InStr(i, strXML, Chr(34))
'Second double quote after that
j = InStr(i + 1, strXML, Chr(34))
strReplace = Mid(strXML, i + 1, j - i - 1)
strXML = Replace(strXML, strReplace, strImportFile)
Access.CurrentProject.ImportExportSpecifications(spec).XML = strXML
' Put here the code that I have specified in the answer for your previous question:
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Members can enroll in this course at no extra cost.