Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
C

Carter Langley

@Carter Langley
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Automate Word from VB6
    C Carter Langley

    'Start Word and open the document template. Set oWord = CreateObject("Word.Application") oWord.Visible = True Set oDoc = oWord.Documents.Add oDoc.PageSetup.Orientation = wdOrientLandscape oDoc.PageSetup.LeftMargin = 10 oDoc.PageSetup.RightMargin = 10 oDoc.PageSetup.TopMargin = 30 'Insert a paragraph at the beginning of the document. Set oPara1 = oDoc.Content.Paragraphs.Add oPara1.Range.Text = "Diamant Drilling Services Run Report" oPara1.Range.Font.Name = "Arial Rounded MT Bold" oPara1.Range.Font.Color = wdColorBlue oPara1.Range.Font.Size = 28 oPara1.Range.Font.Bold = False oPara1.Range.InsertParagraphAfter oPara1.Range.InsertParagraphAfter Set oPara1 = oDoc.Content.Paragraphs.Add oPara1.Range.Text = "QDC" oPara1.Range.Font.Name = "Arial" oPara1.Range.Font.Color = wdColorBlue oPara1.Range.Font.Size = 8 oPara1.Range.Font.Bold = True Ok, there is the code that opens word, opens a new document and starts to insert some things into it. my problem begins with the last block of code. once it has written the word "QDC", how do i then write another word after it on the same line without overwriting the "QDC":confused: I am extracting info from a database and the recordset is going to be used to populate the document. So you will have the following senario:- QDC TYPE NUMBER SPH423 PDC S6L1543 the second line contains the data that is extracted from the database and has to be inserted under the relevent "column headings". there might be only one record or there might be over 200, depends on what the user has searched for. Any ideas on how to do this guys?

    Visual Basic question database help tutorial

  • Automate Microsoft Word From VB6
    C Carter Langley

    Dim strCountry As String Dim strCustomer As String Dim strManufacturer As String Dim strBitMake As String Dim strBitSize As String Dim strMotorType As String Dim strBlockNumber As String Dim strSectionNumber As String Dim strDepthIn As String Dim strDepthOut As String Dim strFootageDrilled As String Dim strFormation As String Dim strFormation1 As String Dim strSearch As String Dim strRst As String Dim strPunctuation As String Dim lngLen As Integer Dim oWord As Word.Application Dim oDoc As Word.Document Dim oTable As Word.Table Dim oPara1 As Word.Paragraph Dim oRng As Word.Range Dim oShape As Word.InlineShape Dim oChart As Object Dim Pos As Double If cboCountry.Text <> "" Then strCountry = cboCountry.Text strRst = "SELECT Countryid FROM Country WHERE Country LIKE " & "'" & strCountry & "'" Rst.Open strRst, Cnn, adOpenDynamic, adLockOptimistic strCountry = "BitRun.CountryID = " & Rst.Fields("Countryid").Value & " AND " Rst.Close strRst = "" Else strCountry = "" End If If cboCustomer.Text <> "" Then strCustomer = cboCustomer.Text strRst = "SELECT Customerid FROM Customer WHERE Customer LIKE " & "'" & strCustomer & "'" Rst.Open strRst, Cnn, adOpenDynamic, adLockOptimistic strCustomer = "BitRun.customerid = " & Rst.Fields("Customerid").Value & " AND " Rst.Close strRst = "" Else strCustomer = "" End If If cboManufacturer.Text <> "" Then strManufacturer = cboManufacturer.Text strRst = "SELECT BitManufacturerid FROM Bit_Manufacturer WHERE Manufacturer LIKE " & "'" & strManufacturer & "'" Rst.Open strRst, Cnn, adOpenDynamic, adLockOptimistic strManufacturer = "BitRun.BitManufacturerid = " & Rst.Fields("BitManufacturerid").Value & " AND " Rst.Close strRst = "" Else strManufacturer = "" End If If cboBitSize.Text <> "" Then strBitSize = "BitRun.Size = '" & cboBitSize.Text & "' AND " Else strBitSize = "" End If If cboMotorType.Text <> "" Then strMotorType = cboMotorType.Text strRst = "SELECT MotorID FROM Motor WHERE MotorType LIKE " & "'" & strMotorType & "'" Rst.Open strRst, Cnn, adOpenDynamic, adLockOptimistic strMotorType = "BitRun.MotorID= " & Rst.Fields("MotorID").Value & " AND " Rst.Close strRst = "" Else strMotorType = "" End

    Visual Basic database help

  • query related to vb
    C Carter Langley

    Dim Cnn As ADODB.Connection Dim Rst As ADODB.Recordset set cnn = new adodb.connection Cnn.Open "Your database connection statement goes here" set rst = new adodb.recordset rst.open "Your SQL Query Statement",Cnn,adOpenDynamic, adLockOptimistic you can now manipulate your database information, like add, delete, etc. hope this helps. this works for VB6 when you have referenced ado.

    Visual Basic database

  • Automate Microsoft Word From VB6
    C Carter Langley

    Hi guys,girls,others need to automate a report in word using vb6 and the results of a query on an access database. got as far as getting the info from the database now need to put it all in word. problem is the info might contain just one record or it might contain over 200 records, or even more, or nothing. so, never having accessed word from vb6 before and the last time i tried to write code was 8 years ago, i am having some problems here as you can well imagine. help would be greatly appreciated.

    Visual Basic database help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups