All about VB for RSView32.

ckchew666

Member
Join Date
Aug 2003
Location
Malaysia
Posts
591
Hi,

I'm new to VB

I'm trying to create & open an excel file name abc (.xls) in

C:\NBUTANE_Project\Reporting\rsview_excel\VBA

_____________________________________________________________
Sub create()
Dim objExcel As Object
Dim sExcelFilePath As String

Set objExcel = CreateObject("Excel.Application")
sExcelFilePath = gProject.Path & "\VBA\abc.xls"
objExcel.Workbooks.Open (sExcelFilePath)

End Sub
_________________________________________________________________

This VB scripts will be load into RSView32, so when I click on the 'create abc' button as, i'll get the abc.xls file created automatically and open up.

But no luck, does anyone here knows if I'm doing the script right?

I tried to 'step-over' the script (press F8 + Shift), it only shows running on top of the VB, but no file is created
 
RSView

They have a sample program that shows you how to open an excel file.
Here is a snippet of what I have.
You may have forgot: objExcel.Application.Visible = True


Set objExcel = CreateObject("Excel.Application")
sExcelFilePath = gProject.Path & "\VBA\CoffeeMaker.xls"
objExcel.Workbooks.Open (sExcelFilePath)
' Make Excel visible through the Application object
objExcel.Application.Visible = True
'-4137 is used instead of xlMaximized because to use xlMaximized, Excel must be selected
' in the references. If Excel is selected in the references and Excel is not installed
' on the machine the project will not run. Normally a user would use the Excel variable names
' but -4137 was used to ensure that the Samples worked on any machine regardless whether Excel
' installed or not. Also objExcel would be dimmed as 'dim objExcel as Excel.Application'
objExcel.Application.WindowState = -4137 '-4137=xlMaximized
objExcel.Application.ActiveWindow.WindowState = -4137 '-4137=xlMaximized
' Find out the size of the Excel to figure out resolution
sHeight = objExcel.Height
objExcel.Worksheets("Source Data").Activate
objExcel.Columns(1).ColumnWidth = 13.5
objExcel.Columns(2).ColumnWidth = 19
'Set an RSView tag to show animation on Architecture screen
tagProcessState.Value = 15
' Resize to if using smaller resolution than 1024 x 768
If sHeight < 350 Then
objExcel.ActiveWindow.Zoom = 50
ElseIf sHeight < 440 Then
objExcel.ActiveWindow.Zoom = 75
End If
'Center the columns
For nColumn = 1 To 7
objExcel.Columns(nColumn).HorizontalAlignment = -4108 '-4108=xlCenter
Next nColumn
With objExcel
.Rows(1).Font.Bold = True
.Cells(1, 1).Value = "Time and Date"
.Cells(1, 2).Value = "Recipe Name"
.Cells(1, 3).Value = "Coffee"
.Cells(1, 4).Value = "Sugar"
.Cells(1, 5).Value = "Cream"
.Cells(1, 6).Value = "Cocoa"
.Cells(1, 7).Value = "Irish"
End With
 
How to add Borders

Hi,
Is there any method to format excel file which we have created and logged data into....actually i want to add Borders and format the text.....
I tried with the following code

report.Application.range(3, 2).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With

but unable to format it,
anyone with the solution???????

thanks....
 

Similar Topics

I'm importing an RSView32 project into FTView SE. I'm using Legacy Tag Database Conversion on a virtual machine with Windows XP, I did the first...
Replies
0
Views
373
Hi everybody, I have a rsview32 application, when I try to run it it loads upto 80% system settings and the crashes saying Rsview32 Project...
Replies
3
Views
1,911
Hi Guys I'm having trouble assigning a tag to an activex label on a Multipage Tab. I can assign the tag to an active x label on a normal display...
Replies
0
Views
596
I have followed the procedure below to convert RSView32 project to FactoryTalk View...
Replies
5
Views
1,431
I have converted RSV32 to FTVSE Distributed. pretty straightforward... I cant seem to figure out how or find any documentation to migrate RSV32...
Replies
4
Views
2,305
Back
Top Bottom