Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Openning an excel doc and editing it from access 1

Status
Not open for further replies.

hondaman2003

Programmer
Mar 3, 2008
202
US
I just need to open an excel document from access. I would simply like to change a single cell to a percent format. How do I do that?
 
Use Automation.
Have a look at the CreateObject or GetObject functions.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I am using automation. I have the document open and know how to refer to a specific cell or a range of cells, but cannot seem to set this particular property. I can't seem to figure out the syntax.
 
Try starting the Macro Recorder, format the cell then turn off the Recorder and look at the code.
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Assumming everything has been done to change the format the code would be something like this.

.Cells(12, 10).Value = Format(MyReadings1!std, "0.00%")

Bearing in mind there are a few other steps to select the range.

Hennie
 
change a single cell to a percent format
yourCellObject.NumberFormat = "0.00%"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
This
.Cells(12, 10).Value = Format(MyReadings1!std, "0.00%")

changes the value, try something like this

.Cells(12, 10).Value = MyReadings1!std
.Cells(12, 10).NumberFormat = "0.00%"

Roy-Vidar
 


Hennie said:
Assumming everything has been done to change the format the code would be something like this.

.Cells(12, 10).Value = Format(MyReadings1!std, "0.00%")

Bearing in mind there are a few other steps to select the range.
That would not be correct!

The Format function returns a STRING, actually CHANGING the value in the cell. This is not an Excel Format!

Rather...
Code:
.Cells(12, 10).NumberFormat = "0.00%"


Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top