M
Martin
Hello,
I have some coded (posted below) that transfers into Excel a number of
queries. This works fine however the spreadsheet I am transfering to needs
to be password protected (open only, not to write to). When the Excel file
is password protected Access quite rightly states it cannot transfer to the
file.
My question is, is there anyway to bypass this? i suppose what i need to do
is get Access to let Excel know the password and continue in the usual way.
As you will see from the code it does this process for each item in a list,
sometimes this list can contain 100's of names so it would work to open each
file physically.
If anyone has any suggestions then please let me know. Please!!
Here is the code:
For Each vItem In Me.Name.ItemsSelected
ubName = Me.Name.ItemData(vItem)
SourceFile = "c:\Temp\AD Pack.xls"
DestinationFile = "c:\temp\" & Me.ubName & ".xls"
FileCopy SourceFile, DestinationFile
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report
01", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report
01_1", DestinationFile, True
Me.intProgress = Me.intProgress + 1
Me.Repaint
Next
Many thanks,
Martin
I have some coded (posted below) that transfers into Excel a number of
queries. This works fine however the spreadsheet I am transfering to needs
to be password protected (open only, not to write to). When the Excel file
is password protected Access quite rightly states it cannot transfer to the
file.
My question is, is there anyway to bypass this? i suppose what i need to do
is get Access to let Excel know the password and continue in the usual way.
As you will see from the code it does this process for each item in a list,
sometimes this list can contain 100's of names so it would work to open each
file physically.
If anyone has any suggestions then please let me know. Please!!
Here is the code:
For Each vItem In Me.Name.ItemsSelected
ubName = Me.Name.ItemData(vItem)
SourceFile = "c:\Temp\AD Pack.xls"
DestinationFile = "c:\temp\" & Me.ubName & ".xls"
FileCopy SourceFile, DestinationFile
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report
01", DestinationFile, True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Report
01_1", DestinationFile, True
Me.intProgress = Me.intProgress + 1
Me.Repaint
Next
Many thanks,
Martin