# How to read a vba code of another excel using vba code

How to read a vba code of another excel file using vba code

Posted by on

• Level 1:

An expert who has achieved level 1.

Corporal:

An expert that hasĀ over 10 points.

Mayor:

An expert whose answer gotĀ voted for 2 times.

• Contributor

R u talking of macros?

Posted on Jun 30, 2008

• Level 1:

An expert who has achieved level 1.

• Contributor

'If the user forgets to write something in the number place-holders,
If aTxt.Text = "" Or bTxt.Text = "" Or cTxt.Text = "" Then
'than tell him
msg = MsgBox("You forgot to enter a number.", vbCritical + vbOKOnly, "Error")
'and exit this sub
Exit Sub
End If
If aTxt.Text = 0 Then
msg = MsgBox("That isn't a quadratic equation, a musn't equal 0.", vbCritical + vbOKOnly, "Error")
aTxt.SetFocus
Exit Sub
Else
'Assigns the values the user gave to a, b and c
a = aTxt.Text
b = bTxt.Text
c = cTxt.Text
'and calculates the discr and the Apex
discr = (b * b) - (4 * a * c)
ApexX = (-b) / (2 * a)
ApexY = -discr / (4 * a)
End If
If discr < 0 Then
Msg3.Caption = "There are no answers for " & a & "x² + " & b & "x + " & c & " = 0." & vbCrLf & vbCrLf & "The coordinates of the apex are (" & ApexX & ";" & ApexY & ")."
ElseIf discr = 0 Then
x = (-b) / (2 * a)
Msg3.Caption = "The answer for " & a & "x² + " & b & "x + " & c & " = 0 is " & x & "." & vbCrLf & vbCrLf & "The coordinates of the apex are (" & ApexX & ";" & ApexY & ")."
ElseIf discr > 0 Then
x1 = (-b - Sqr(discr)) / (2 * a)
x2 = (-b + Sqr(discr)) / (2 * a)
Msg3.Caption = "The answers for " & a & "x² + " & b & "x + " & c & " = 0 are " & x1 & " and " & x2 & "." & vbCrLf & vbCrLf & "The coordinates of the apex are (" & ApexX & ";" & ApexY & ")."
End If

Posted on Jun 24, 2010

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
goodluck!

Posted on Jan 02, 2017

×

my-video-file.mp4

×

## Related Questions:

### How to convert vba macros to visual studio?

1. Clean your code. There are built in Application specific functions which don't work in VB Studio. Some will require you pre-load the application first, others just don't work at all.
2. Save the VBA module as a BAS file. This is just a text file with the module code in it.
3. Export your forms to file.
4. Open Visual Studio
5. Import your forms and modules
6. Clean it up.
7. Compile it

Apr 28, 2010 | Microsoft Visual Studio 2008 Professional...

Tip

### Computer Tips: Open Office 2007 Files into Office 2003

How to open office 2007 files into Office 2003?
Today tip will help you to resolve the compatibility issues between the Office 2003 and Office 2007. Because all programs in office 2003 used the old file extensions for its different programs. For example Word 2003 saved files with extension .doc, Excel 2003 with .xls and PowerPoint with .ppt. but on the other office 2007 used the new file extensions for its different programs. For example Word 2007 saved files with extension .docx, Excel 2007 with .xlsx and PowerPoint with .pptx. Now the problem is that when you will try to open office 2007 files into office 2003 and you will not open the file due to compatibility issues between both office versions. Microsoft provides a free compatibility pack to convert office 2007 documents to the office 2003 format. There are many third party free converter are available but here we are using Microsoft office compatibility pack.
To use this feature, you will need to be logged into your computer with administrative rights.
When you have downloaded the file, double click on FileFormatConverter.exe file to start the installation.
Now here it’s simply a case of pretending you’ve read the license terms and clicking continue.

Now click on OK button to complete the installation.

on Mar 08, 2010 | Computers & Internet

### My OS is windows xp professional and my MS office is 2007 version.. people are unable to view the files i send them..especially word and excel.. pls help me

Office 2007 saves files in a new set of formats by default. If you colleagues cannot read these files, likely they are not using software compatible with these formats.

You can save these file in other formats by opening the relevant document in Office 2007 and, under "FILE" click "Save As..." and save the document in a compatible format; .doc instead of .docx, for example.

Apr 06, 2010 | Microsoft Computers & Internet

### In microsoft excel sheet how do we copy zodiac signs written in front of employee from one sheet to another by writing a formulae in the blank space eg 1 amit scorpio 2 divik saggitarius 2 tisha...

When the cell is in a different sheet in the same file use:
=sheet-name!cell-name as in =Sheet1!A1

If the cell you want is in a different sheet in a different file use:
=[file-name]sheet-name!cell-name

as in: ='[sample excel 2.xls]Sheet1'!\$A\$1

The easiest way to do it is in the blank cell, type an equals sign "=" then go to the cell you want to copy, then press enter. All the correct formatting will be handled for you. (Sometimes you need quotes when you have spaces in the filenames and or sheet names.)

Sep 06, 2009 | Computers & Internet

### Can i get vba code to list objects in a group in listbox1 without ungrouping the object?

You can look at each item in the Groupitems collection of a group. Those are the shapes if they are grouped.:

Sub group()
For Each one In ActiveSheet.Shapes
If one.GroupItems.Count > 0 Then
For Each one2 In one.GroupItems
MsgBox (one2.Name)
Next
End If
Next
End Sub

Mar 17, 2009 | Microsoft Computers & Internet

### Write into excel format

Your code does not save in access format it just makes a copy of existing file. You need to open table by table and export data using csv format.
It can be done using access OLE to export, or
write some VB code to access the database tables via ODBC and save row data to csv file

Feb 17, 2009 | Microsoft Visual Basic Professional...

### Write into excel format

You can use ADO or SQL to open the excel file directly (provided it is constructed correctly, ie fields names) and write the data to it without Access.
That might be eaiser thatn converting it from Access to Excel, if that can even be done.

Feb 17, 2009 | Microsoft Visual Basic 6.0 for PC

Excel is not able to be programed like that and still retain the data. Create 12 monthly spreadsheets and use them as they are needed.

Dec 08, 2007 | Computers & Internet

## Open Questions:

#### Related Topics:

423 people viewed this question

Level 3 Expert

Level 3 Expert