Invalid Characters

S

shaggles

I'm trying to automate linking a spreadsheet to my
database but the worksheet name has an invalid character.
The people I'm doing this for are resistant to changing
this name. Is there a way around an invalid character in
the range arguement of the TransferSpreadsheet method?
Here's my code:
Function Load_Trades()
On Error GoTo Err_Load_Trades
Dim strChase As String
strChase = InputBox("Enter complete name of spreadsheet
including path" & Chr(13) & "(Example:
C:\Temp\MySpreadsheet.xls)")
DoCmd.TransferSpreadsheet acLink, 8, "Chase_GS(TEMP)",
strChase, True, "Worksheet-Securities!"
DoCmd.TransferSpreadsheet acLink, 8, "Chase_FA(TEMP)",
strChase, True, "'Worksheet-Fixed Annuities'!"
DoCmd.TransferSpreadsheet acLink, 8, "Chase_IP(TEMP)",
strChase, True, "'Insurance Prod.'!"
DoCmd.TransferSpreadsheet acLink, 8, "Chase_IA(TEMP)",
strChase, True, "'FC-IA Worksheet'!"
Exit_Load_Trades:
Exit Function
Err_Load_Trades:
MsgBox Err.Description
Resume Exit_Load_Trades

End Function
The problem is the "." in 'Insurance Prod.'. I tried
enclosing it in '' like this "'Insurance Prod''.''" and I
didn't get the Invalid String error message but it
couldn't find the worksheet. Does anyone know the right
way to do this? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top