By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

Creating MS Word Document using Vb 6.0

P: 4
I have Invoked Ms Word using VB 6.0 as an OLe Object. Its working perfectly except that its not showing the toolbars. Can anybody help me out?
Sep 18 '07 #1
Share this Question
Share on Google+
3 Replies


hariharanmca
100+
P: 1,977
Be clear with your problem.
  • version of VB
  • What is your problem ?
  • Can you post the code what you had tried?
  • What is the error that you are getting?
Sep 18 '07 #2

QVeen72
Expert 100+
P: 1,445
Hi,


Make VB6 Form's property NegotiateMenus = True


Regards
Veena
Sep 18 '07 #3

P: 4
I want that MS Word toolbars (Standard, Formatting etc ) should appear on the Screen when I use OLE object to invoke MS Word. My Code is given Below.


Dim oDocument As Object
Dim omenubar As Object


Private Sub Command1_Click()
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
On Error GoTo Err_Handler


' Create a new Word Document...
OLE1.CreateEmbed vbNullString, "Word.Document"

' Add some text to the document. The OLE.Object
' property returns the document object...
Set oDocument = OLE1.object


' Zoom to see entire document...
OLE1.SizeMode = 3
OLE1.DoVerb -1

Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = True


Exit Sub


Err_Handler:
MsgBox "An error occurred: " & Err.Description, vbCritical
End Sub

Private Sub Command2_Click()

' Create an embedded object using the data
' stored in Test.doc...

OLE1.CreateEmbed (d)
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = True

Exit Sub

End Sub

Private Sub Command3_Click()
On Error Resume Next

' Delete the existinf test file (if any)...
'Kill (d)

' Save the file as a native Word DOC file...
oDocument.saveas (d)
Set oDocument = Nothing

' Close the OLE object and remove it...
OLE1.Close
OLE1.Delete

Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = False

End Sub

Private Sub Form_Load()
Command1.Caption = "Create"
Command2.Caption = "Open"
Command3.Caption = "Save"

End Sub

Private Sub Text1_Change()
a = Text1.Text

Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = False
End Sub

Private Sub Text2_Change()
b = Text2.Text
c = "c:\r\"
e = ".doc"
d = c & a & b & e
End Sub
Sep 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.