J
J Streger
I have a tools suite that I have linked to an .xla in order to allow it to be
utilized at all times. I have everyone install an xla that just opens the
tools xla. this way I can update my tools xla and the updates are invisible
to the end user. Well now we have a sharepoint that stores the files, and I
can open them from Excel, but trying to use FileCopy on the website file just
fails. My code looks like:
Sub InstallAddin()
'********************************************************************
'* *
'* This will install the Useful Tools Addin onto the user's copy *
'* of Excel. *
'* *
'********************************************************************
'VAR
Dim sCurLoc As String
Dim sAddinLibLoc As String
Dim sFileName As String
Dim iVerify As Integer
Dim fso As Object
'BEGIN
'Confirm installation. Allow for modifications
iVerify = MsgBox("Are you sure you wish to install " & vbCrLf & _
"Useful tools as an add-in?", vbYesNo)
If iVerify = vbYes Then
'set file name
sFileName = glUSETOOLS & ".xla"
On Error Resume Next
'get current location of addin and location of library path
sCurLoc = ThisWorkbook.Path & "/" & sFileName
'set location for addin. each person needs a local addin
sAddinLibLoc = Application.LibraryPath & "\" & sFileName
'If destination already has file, delete
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.fileexists(sAddinLibLoc) Then Kill sAddinLibLoc
'Close the xla if open to allow for reinstall
Workbooks(sFileName).Close False
'Copy addin in the Excel Library
'MY PROBLEM IS HERE
FileCopy sCurLoc, sAddinLibLoc
'Install Addin in Excel
With AddIns.Add(Filename:=sAddinLibLoc)
.Installed = True
End With
'Close Installer
ThisWorkbook.Close False
On Error GoTo 0
End If
End Sub 'InstallAddin
I verified all the paths to ensure they are pointing to the correct places.
the user opens an .xls file that runs the code, and installs the .xla that is
located in the same path, copying the xla to their addin library.
So is there another way to copy the file from a website to a harddrive than
FileCopy?
--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003
User of MS Office 2003
utilized at all times. I have everyone install an xla that just opens the
tools xla. this way I can update my tools xla and the updates are invisible
to the end user. Well now we have a sharepoint that stores the files, and I
can open them from Excel, but trying to use FileCopy on the website file just
fails. My code looks like:
Sub InstallAddin()
'********************************************************************
'* *
'* This will install the Useful Tools Addin onto the user's copy *
'* of Excel. *
'* *
'********************************************************************
'VAR
Dim sCurLoc As String
Dim sAddinLibLoc As String
Dim sFileName As String
Dim iVerify As Integer
Dim fso As Object
'BEGIN
'Confirm installation. Allow for modifications
iVerify = MsgBox("Are you sure you wish to install " & vbCrLf & _
"Useful tools as an add-in?", vbYesNo)
If iVerify = vbYes Then
'set file name
sFileName = glUSETOOLS & ".xla"
On Error Resume Next
'get current location of addin and location of library path
sCurLoc = ThisWorkbook.Path & "/" & sFileName
'set location for addin. each person needs a local addin
sAddinLibLoc = Application.LibraryPath & "\" & sFileName
'If destination already has file, delete
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.fileexists(sAddinLibLoc) Then Kill sAddinLibLoc
'Close the xla if open to allow for reinstall
Workbooks(sFileName).Close False
'Copy addin in the Excel Library
'MY PROBLEM IS HERE
FileCopy sCurLoc, sAddinLibLoc
'Install Addin in Excel
With AddIns.Add(Filename:=sAddinLibLoc)
.Installed = True
End With
'Close Installer
ThisWorkbook.Close False
On Error GoTo 0
End If
End Sub 'InstallAddin
I verified all the paths to ensure they are pointing to the correct places.
the user opens an .xls file that runs the code, and installs the .xla that is
located in the same path, copying the xla to their addin library.
So is there another way to copy the file from a website to a harddrive than
FileCopy?
--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003
User of MS Office 2003