Private Sub c01_Click()
If ps = "" Then
MsgBox ("请填写完整信息后再操作本项!")
Else
'查询色彩季节'生成文件
text1.Text = FileContent(App.Path & "\doc1\" & ps & ".htm")
text1.Text = Replace(text1.Text, "$r$username$f$", username)
text1.Text = Replace(text1.Text, "$r$bh$f$", bh)
text1.Text = Replace(text1.Text, "$r$time$f$", Date$)
text1.Text = Replace(text1.Text, "$r$ys$f$", rs("ys"))
text1.Text = Replace(text1.Text, "$r$ys1$f$", rs("ys1"))
text1.Text = Replace(text1.Text, "$r$jy$f$", rs("jy"))
text1.Text = Replace(text1.Text, "$r$sd$f$", rs("sd"))
If Dir(App.Path & "\user\" & bh & username, vbDirectory) = "" Then
MkDir App.Path & "\user\" & bh & username
End If
Open App.Path & "\user\" & bh & username & "\" & "色彩诊断方案.htm" For Output As #1
Print #1, text1.Text
Close #1
Dim RetVal
RetVal = Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE " & App.Path & "\user\" & bh & username & "\" & "色彩诊断方案.htm", 1)
MsgBox "成功生成!文件信息:" & App.Path & "\user\" & bh & username & "\" & "色彩诊断方案.htm"
End If
End Sub

解决方案 »

  1.   

    而且好像是TEXT1。TEXT这个,不知道是为什么?高手指点一下!
      

  2.   

    你连错误提示在那句话上都没讲,你就猜测text1.text啊.
    叫谁帮看看你定义ps是什么没有?
      

  3.   

    如果是text1.text,那就是你的文本框的名称与代码里的不同的原因吧。
      

  4.   

    也有可能是FileContent()的问题。最好给出整个工程看看,大家不要再作无谓的猜测了。