![]() I appreciate any advice that you can give. Something it works and other times it does not. Can you understand why? The problem seems to be with passing in the password string. The problem is that some times the code works and other times it doesn't. I needed to modify it to create a loop that opens and import ranges from a series of spreadsheets. Hi, I found this on google as well and it was a huge help. Public Sub ImportProtected(strFile As String, _ strPassword As String) Dim oExcel As Object, oWb As Object Set oExcel = CreateObject("Excel.Application") Set oWb = (FileName:=strFile, _ Password:=strPassword) DoCmd.TransferSpreadsheet transfertype:=acImport, SpreadsheetType:=5, _ tablename:="tmpTableName", FileName:=strFile, _ Hasfieldnames:=True, Range:="Q1!C:G" oWb.Close SaveChanges:=False oExcel.Quit Set oExcel = Nothing End Sub Thanks Again! 9:29 PM Anonymous said. I made a few changes to accomodate the specific worksheet and range.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |