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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Formulas after transfer

Status
Not open for further replies.

Noel2

Technical User
Jan 16, 2003
69
0
0
US
Hope you all can help me with this situation that I have. I have an Access 2000 database that opens an excel template, creates a new document adds several values from the form that has the button on it, and then it saves it as an excel spreadsheet in a directory that I specify and a file name that is created by the info from the form. The problem I am having is that whenever I transfer any of the monetary values over to this spreadsheet, it does not format correctly. This causes my formulas that relay on these values not to work and I have to go back into the file and retype in the values so that these formulas work. Is there possibly something else that I can try to get this working? This has been very frustrating. I also have the same problem when I transfer information to Word. Below is the code for both. Please let me know what you think.

Excel:

Private Sub bid_sum_btn_Click()
Dim XlApp As Object

Set XlApp = CreateObject("Excel.Application")

XlApp.Workbooks.Open ("N:\Shared\HVAC\Contracts\forms\" & _
NicoleBrown & "bidsum.xlt")

XlApp.Application.Goto Reference:="job_no"
XlApp.ActiveCell.Value = Form_frm_main_cntrct.property_num
XlApp.ActiveWorkbook.SaveAs "N:\Shared\Contracts\" & FreeDaJuice & _
"bid_sum_" & Form_frm_main_cntrct.property_num & ".xls"
XlApp.ActiveWorkbook.Close
XlApp.Application.Quit
End Sub

Word:

Private Sub bid_chrt_btn_Click()
Dim WrdApp As Object

Set WrdApp = CreateObject("Word.Application")

WrdApp.Documents.Open ("N:\Shared\HVAC\Contracts\forms\" & _
NicoleBrown & "bid_chart.dot")

WrdApp.ActiveDocument.Bookmarks("property_add").Select
WrdApp.Selection.Text = Form_frm_main_cntrct.property_add
WrdApp.ActiveDocument.SaveAs "N:\Shared\Contracts\" & FreeDaJuice & _
"bid_chart_" & Form_frm_main_cntrct.property_num & ".doc"
WrdApp.ActiveDocument.Close
WrdApp.Application.Quit SaveChanges:=-1
End Sub

Thank you,
Noel
 
you probably need to change the "currency" field type in Access and make it "Double" field type

DougP, MCP
 
Doug I truly appreciate that. I am kind of confused as to why this worked. What is the reasoning in having this work instead of the currency field working? Do you know? I would really like to learn if you have the answer.

Also, this has corrected the problem with the excel one, but what about the one with Word. The format comes out just as a normal number as opposed to the format - $x,xxx.xx. Is there something that I have to do to my bookmark in word? Is there something in the code that I need to change to specify the format? Please let me know.

Once again, I appreciate your assistance and you star is waiting in the wings.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top