-
WSscrappe7
AskWoody LoungerWe have changed our mission with ‘the monster’ please check out my new post:
-
WSscrappe7
AskWoody Loungerends up the problem existed because the name of the sheet it was looking in had a ” ” it so excel thought i was calling a new directory when in fact that was just the name of the sheet, thanks for the help though.
-
WSscrappe7
AskWoody LoungerBeen there done that and i still get the same error that the folder/file i specified wasnt accessible or may be password protected. Then the pop up screen occurs and it lets me find the file, when i do i get a could not read file error. any clues?
-
WSscrappe7
AskWoody LoungerSince the workbook was already open i tried
appExcel.Run “TopAlign”
But it says it can not find that macro, what is the correct path to set for the macro name?
And now i am editing this post to inform you i have finally fixed one of my own problems.
appExcel.Run “ThisWorkbook.TopAlign”
Hell just may freeze over tonight…..
Thanks -
WSscrappe7
AskWoody LoungerYou were right as usual Legare, the wrap text was already doing what i needed. I decided to manually set all my cloumn widths and then just wrap the text. got rid of all the autofitting, how simple life may be. Thank you.
-
WSscrappe7
AskWoody LoungerWhen i tried to make the links in excel. This is after they were outputed by access to their destination. ALL access does is output to that file. I am in excel and i hit = in a cell on one page and try to put a link to another excel file and then the errors occur.
-
WSscrappe7
AskWoody LoungerI found this to do the trick nicely, thanks for the help
Public Function TrnsToXls()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, “Find All Issues by Selected
Criteria2”, “C:WINNTProfilesEdward SantevecchiDesktopFind All Issues By Selected Criteria2.xls”
End Function -
WSscrappe7
AskWoody LoungerThat whole private function thing was just a mistake. But if i did make it a public function how would i use it in a macro so that RunCode would work? I’ve tried RunCode, function name TrnsToXls() but it will not work. humm….
-
WSscrappe7
AskWoody Loungerended up working after i deleted the file first then let the code create the file, don’t ask me why. working fine for now thanks. sorry about the multiposts before. didnt know everything was connected like that.
However, I would like to have that excel file open after the export takes place. I added a line that i’ve used in modules to open excel but i get variable not defined.
Private Sub cmdExp_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, “Find All Issues by Selected
Criteria2”, “C:WINNTProfilesEdward SantevecchiDesktopFind All Issues By Selected Criteria2.xls”‘Open Dummy File
appExcel.Workbooks.Open “C:WINNTProfilesEdward SantevecchiDesktopFind All Issues By
Selected Criteria2.xls”
End Subdoes appExcel.Workbooks.Open not work with the _click event??? ANy other way? Thanks
-
WSscrappe7
AskWoody LoungerOK charlotte,
So i think i have the part that checks each button and appropriate list box. Since each listbox has 2 possibel options (AND/OR) wouldn’t it look more like this:
strCriteria = strCriteria& MakeCriteria(lstBox1,LstBox1Op)
strCriteria = strCriteria & MakeCriteria(lstBox1,LstBox2Op)OR am i doing something that says
IF lstbox1op = 1 then strCriteria = strCriteria& MakeCriteria(lstBox1,LstBox1Op)
IF lstbox2op =1 then strCriteria = strCriteria& MakeCriteria(lstBox1,LstBox2Op)Siince it is a saved query what is this whole pasing of the parameters issue. Doesnt sound too tempting for me. I guess the biggest problem is what that function would look like, i am assuming it is a function called MakeCriteria and tells access to look in that listbox for the values selected and decide whether or not it is an AND/OR field to be included in the query? If i’m right (slim chance) how would you write something like that, are their reserved words that do this for you? Thank you.
-
WSscrappe7
AskWoody LoungerThey already are memo fields
-
WSscrappe7
AskWoody LoungerOK here’s the code again:
Private Function TrnsToXls()
DoCmd.TransferSpreadsheet 1, 5, “Find All Issues By Selected Criteria2”, “C:WINNTProfilesEdward SantevecchiDesktopFind All Issues By Selected Criteria2.xls”
End Function
I can not execute the function with the F5, same error. When i try to run a macro that consists of RunCode, using TrnsToXls() as the function name I get the error that Access can not find the expression I entered.
I am using this code to copy what is in acess from the query material chosen and then send it to excel. When you export to excel from acess it will only handle 255 characters. Some of my fields in access have 500+ characters so i lose half of the field on the export. When the user selects the criteria for the query on a form and hits the command button the query checks for what was selected (thus it is opened), outputs the data to an excel file, runs this code, closes query. I The reason i output to excel before the code is run is to leave the user at the excel file they are exporting to. I will eventually make this file a template file so all data would go it and then get saved as something else, preserving the code destination. If i runt he code w/o the output to excel the same errors still occur.
What to do? Do you knwo of any other way to export data to excel automatically. I know a paste special, as unicode will work from access to excel but i can not get that to work automatically. Thank you. Have i stumped you completly yet????
-
WSscrappe7
AskWoody LoungerEdited by gwhitfield on 01-Jan-02 22:19.
** cross-posted here **
Well if i can get this to work that would be great. I entered the code into a VB module in access as follows
I recived it from another forum but something i am doing is wrong.Public Function TrnsfrToXls()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, “Find All Issues by Selected Criteria2”, “C:WINNTProfilesEdward SantevecchiDesktopFind All Issues By Selected Criteria2.xls”
End Function
All of the coding is on 1 line correct? The “Find All Issues by Selected Criteria” is not a table but a datasheet created by the query. Is that a problem, if so how would i change that to a table. Have i set the paths up incorrectly?
My access macro first opens the query (Find All issues….) in DATASHEET view with the mode set to EDIT.
Then I have output to my xls file (Find all ISSues…)
I then use RunCode and use the line:
Function Name = TrnsfrToXls(). {for some reason access says that i have entered the function name incoorectly and it can not find it, have i used an improper format. I thought it was function name = function name().Next i close the query. What am i doing wrong with the function name? Why can’t i run the code? Is there something dumb i am missing here with my procedures? Thank you and happpy new year.
-
WSscrappe7
AskWoody LoungerOk that’ll run it but im still getting an error, it says:
Run time error 3274
External table isnt in the expected formatwhat to do
-
WSscrappe7
AskWoody LoungerThe query was made the normal way, i did not use code to create it. It is a basic query all i entered was teh field, table, show(check/uncheck), and the criteria and then repeated for each field. I think that is what you are looking for.
So i just add the radio buttons assign them names and do nothing woth them but place a caption for each that says “AND” and 1 that says “OR”. Alll the coding would be in my command button that executes the query. When entering the code i assume it would be:
Private Sub Command28_Click()
LstBox1Op = iif(optBox1,”AND”,”OR”) ‘ where LstBox1Op is the AND option button
LstBox2Op = iif(optBox2,”AND”,”OR”) ‘where LstBox2Op is also the AND option for the 2nd listboxSo I take it my OR codes that will be placed in my command button would be
LstBox3Op = iif(optBox1,”OR”, “AND”) ‘ where LstBox1Op is the 1st OR option button
LstBox4Op = iif(optBox2,”OR”,”AND”) ‘where LstBox2Op is the 2nd OR option for the 2nd listbox
??????what the heck is this part doing:
strCriteria = MakeCriteria(lstBox1,LstBox1Op)
strCriteria = strCriteria & MakeCriteria(lstBox2,LstBox2Op)My guess is it assigns the values in the 1st list box based on whther or not the option button is selected, to a string variable and then adds that to the selected options for the 2nd list box. Thus making a long string to perform the query. If there were more than 2 listboxes the next lines would read
strCriteria = MakeCriteria(lstBox1,LstBox1Op)
strCriteria = strCriteria & MakeCriteria(lstBox2,LstBox2Op)
strCriteria = strCriteria & strCriteria & (lstBox3,LstBox3op)
strCriteria = strCriteria & strCriteria & strCriteria & (lstBox4,LstBox4op)I look at this and it makes no programming sense to me, i guess because i am not a good programmer. Am i on the right track at least?? So ill put this all into by command button on the event click and this will allow me to select multiple choices from a list box, decide which listboxes must(AND) / may(OR) be included in the query. Others have mentioned a foreign term to be called OLE that i will need, is this it? I hope so becuase i am lost enough as is. Thank you very much, happy new year!!!
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
The local account tax
by
Susan Bradley
33 minutes ago -
Recall is back with KB5055627(OS Build 26100.3915) Preview
by
Alex5723
2 hours, 12 minutes ago -
Digital TV Antenna Recommendation
by
Win7and10
5 hours, 34 minutes ago -
Server 2019 Domain Controllers broken by updates
by
MP Support
10 hours, 29 minutes ago -
Google won’t remove 3rd party cookies in Chrome as promised
by
Alex5723
12 hours, 8 minutes ago -
Microsoft Manager Says macOS Is Better Than Windows 11
by
Alex5723
15 hours, 20 minutes ago -
Outlook (NEW) Getting really Pushy
by
RetiredGeek
4 hours, 38 minutes ago -
Steps to take before updating to 24H2
by
Susan Bradley
3 hours, 10 minutes ago -
Which Web browser is the most secure for 2025?
by
B. Livingston
2 hours, 56 minutes ago -
Replacing Skype
by
Peter Deegan
5 hours, 42 minutes ago -
FileOptimizer — Over 90 tools working together to squish your files
by
Deanna McElveen
9 hours, 12 minutes ago -
Excel Macro — ask for filename to be saved
by
nhsj
17 hours, 39 minutes ago -
Trying to backup Win 10 computer to iCloud
by
SheltieMom
10 hours, 7 minutes ago -
Windows 11 Insider Preview build 26200.5570 released to DEV
by
joep517
2 days, 15 hours ago -
Windows 11 Insider Preview build 26120.3941 (24H2) released to BETA
by
joep517
2 days, 17 hours ago -
Windows 11 Insider Preview Build 22635.5305 (23H2) released to BETA
by
joep517
2 days, 17 hours ago -
No April cumulative update for Win 11 23H2?
by
Peobody
1 day, 5 hours ago -
AugLoop.All (TEST Augmentation Loop MSIT)
by
LarryK
2 days, 17 hours ago -
Boot Sequence for Dell Optiplex 7070 Tower
by
Serge Carniol
3 days, 8 hours ago -
OTT Upgrade Windows 11 to 24H2 on Unsupported Hardware
by
bbearren
3 days, 12 hours ago -
Inetpub can be tricked
by
Susan Bradley
1 day, 19 hours ago -
How merge Outlook 2016 .pst file w/into newly created Outlook 2024 install .pst?
by
Tex265
2 days, 6 hours ago -
FBI 2024 Internet Crime Report
by
Alex5723
3 days, 16 hours ago -
Perplexity CEO says its browser will track everything users do online
by
Alex5723
1 day, 1 hour ago -
Login issues with Windows Hello
by
CWBillow
4 days, 3 hours ago -
How to get into a manual setup screen in 2024 Outlook classic?
by
Tex265
3 days, 15 hours ago -
Linux : ARMO rootkit “Curing”
by
Alex5723
4 days, 14 hours ago -
Employee monitoring app leaks 21 million screenshots in real time
by
Alex5723
4 days, 14 hours ago -
Google AI is now hallucinating idioms
by
Alex5723
4 days, 15 hours ago -
april update
by
69800
2 days, 19 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.