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
  1. Home
  2. General Programming
  3. Visual Basic
  4. VBS & Excel Files

VBS & Excel Files

Scheduled Pinned Locked Moved Visual Basic
tutorialtoolsregexannouncementlearning
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    king_ging
    wrote on last edited by
    #1

    Hi Ladiez & Gentz, this is an example out of my Learn Scripting In 2 Hours Book (Yeah Right) it opens excel and then creates a new workbook and changes some of the cell properties and enters some info but what i want is to open excel and then OPEN a workbook - anyone got any idea on how to thanks in advance Alex T @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ L_Welcome_MsgBox_Message_Text = "This script will display Windows Scripting Host properties in Excel" L_Welcome_MsgBox_Title_Text = "Windows Scripting Host & Excel" 'Excel Sample Dim objXL Set objXL = WScript.CreateObject("Excel.Application") objXL.Visible = True objXL.Workbooks.Add objXL.Columns(1).ColumnWidth = 20 objXL.Columns(2).ColumnWidth = 30 objXL.Columns(3).ColumnWidth = 40 objXL.Cells(1, 1).Value = "Property Name" objXL.Cells(1, 2).Value = "Value" objXL.Cells(1, 3).Value = "Description" objXL.Range("A1:C1").Select objXL.Selection.Font.Bold = True objXL.Selection.Interior.ColorIndex = 1 objXL.Selection.Interior.Pattern = 1 'xlSolid objXL.Selection.Font.ColorIndex = 2 objXL.Columns("B:B").Select objXL.Selection.HorizontalAlignment = &hFFFFEFDD 'xlLeft Dim intIndex intIndex = 2 Sub Show(strName, strValue, strDesc) objXL.Cells(intIndex, 1).Value = strName objXL.Cells(intIndex, 2).Value = strValue objXL.Cells(intIndex, 3).Value = strDesc intIndex = intIndex + 1 objXL.Cells(intIndex, 1).Select End Sub 'Show WScript Properties Call Show("Name", WScript.Name, "Application Friendly Name") Call Show("Version", WScript.Version, "Application Version") Call Show("FullName", WScript.FullName, "Application Context: Fully Qualified Name") Call Show("Path", WScript.Path, "Application Context: Path Only") Call Show("Interactive", WScript.Interactive, "State Of Interactive Mode") 'Show Command line Arguments Dim colArgs Set colArgs = WScript.Arguments Call Show("Arguments.Count", colArgs.Count, "Number of command line arguments") For i = 0 To colArgs.Count - 1 objXL.Cells(intIndex, 1).Value = "Arguments(" & i & ")" objXL.Cells(intIndex, 2).Value = ColArgs(i) intIndex = intIndex + 1 objXL.Cells(intIndex, 1).Select Next 'Welcome Sub Welcome() Dim intDoIt intDoIt = MsgBox(L_Welcome_MsgBox_Text, vbOkCancel + vbInformation, L_WelcomeTitleText) If intDoIt = vbCancel Then WScript.Quit End If End Sub

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

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