View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Very strange add-in file behaviour

That is what my first thought was as I had just added some code that would
make a VB Script file.
There was some other strange behaviour though that made me think it was not
that, such as a never
ending save of the .xla file, needing a Ctrl + Alt + Del.

This is the code that makes the VB Script file and it would be clever
software that would find that malicious:

Sub MakeVBScriptAutoRunFile(strFile As String)

Dim strVBS As String
Dim strIndent As String

strIndent = String(4, Chr(32))

strVBS = "dim app" & vbCrLf & _
"dim wb" & vbCrLf & vbCrLf & _
"On Error Resume Next" & vbCrLf & _
"Set app = GetObject(," & Chr(34) & "Excel.Application" &
Chr(34) & ")" & vbCrLf & vbCrLf & _
"if Err < 0 Then" & vbCrLf & _
strIndent & "set app = CreateObject(" & Chr(34) &
"Excel.Application" & Chr(34) & ")" & vbCrLf & _
strIndent & "app.Visible = True" & vbCrLf & _
strIndent & "On Error GoTo 0" & vbCrLf & _
"End If" & vbCrLf & vbCrLf & _
"With app" & vbCrLf & _
strIndent & ".DisplayAlerts = False" & vbCrLf & _
strIndent & ".OnKey " & Chr(34) & "{F2}" & Chr(34) & ", " &
Chr(34) & "StartReportForm" & Chr(34) & vbCrLf & _
strIndent & ".OnKey " & Chr(34) & "{F4}" & Chr(34) & ", " &
Chr(34) & "StartReadBrowser" & Chr(34) & vbCrLf & _
strIndent & ".OnKey " & Chr(34) & "{F12}" & Chr(34) & ", " &
Chr(34) & "LoadPatientFromID" & Chr(34) & vbCrLf & _
strIndent & ".OnKey " & Chr(34) & "%z" & Chr(34) & ", " &
Chr(34) & "MakeBPGraph" & Chr(34) & vbCrLf & _
strIndent & ".Workbooks.Open(" & Chr(34) & strFile & Chr(34) &
")" & vbCrLf & _
strIndent & ".UserControl = True" & vbCrLf & _
strIndent & ".DisplayAlerts = True" & vbCrLf & _
"End With"

'done it this way to hopefully fool the v-checker
'------------------------------------------------
StringToTextFile Replace(strFile, _
".xls", _
Chr(46) & Chr(118) & Chr(98) & Chr(115), _
1, _
1, _
vbTextCompare), _
strVBS

End Sub


Maybe I should change the name of the Sub and not mention VBScript !?


RBS



"Tushar Mehta" wrote in message
...
Another possibility to consider is that the download client machine has
some kind of anti-virus software that strips out what it considers
potentially malicious code.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Have developed a large Excel .xla add-in that now shows some very strange
behaviour.
This add-in works completely fine at home, but when I upload the file to
a
website and
download it on a different location there are bits of code missing, for
example all the code
in the ThisWorkbook module and also code from normal code modules. When I
download
the same file at home everything is fine.
It is a large file, 3.8 Mb with a lot of form and modules, but why would
it
be fine on one computer
and not the other. The differences a
Home computer (all fine): Windows XP Pro, Excel 2002
Other computer (not fine): Windows 2000, Excel 2003
I have run the run Andrew Baker's Workbook Rebuilder several times.
Thanks for any advice about this.

RBS