How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Richard Your Own Question

Richard
Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 16842
Experience:  Over 15 year experience resolving Microsoft Office Issues
32989067
Type Your Microsoft Office Question Here...
Richard is online now
A new question is answered every 9 seconds

I am trying to move to the next step in my projec. When I

Resolved Question:

I am trying to move to the next step in my projec. When I run my macro via batch-vbs, the macro seems to become disabled. I have one test file that will select, a range, then use the sendkeys to sort. My final macro will use the PDFMaker addin with Sendkeys. Read that Add-Ins have to be opened when using an Object to open Excel through VBS. Found some sample code, but cannot figure out how to get it working. Why doesn't test file open, and want to open appropriate add-ins w VBS
Submitted: 1 year ago.
Category: Microsoft Office
Expert:  Richard replied 1 year ago.
Thank you for requesting me

Can I look at your excel file please?

- Click the following link: http://www.wikisend.com
- Upload the file to that website
- Once it is uploaded, the resulting page will display a "File ID" number.
- Please, give me that "File ID Number"

Thank you
Customer: replied 1 year ago.

http://wikisend.com/download/398396/test (1).xlsm


 


VBS
Set xl = CreateObject("Excel.application")


xl.Application.Workbooks.Open "C:\sentimenttemplates\test.xlsm"
xl.Application.Visible = True
xl.Application.run "'c:\sentimenttemplates\test.xlsm'!macro1"
'xl.Quit



Set xl = Nothing


 


bat


@echo off


cscript "c:\SentimentTemplates\VBtest.vbs"


 


I have found my macros run ok via auto_exec, but not with the VBS-batch that we developed. This macro1 is my first test which doesn't run. Then, I have another test file, that will pass send keys to use the PDFMAKER addin which is the real macro I want to run. I read that addins are not opened with the object method that we use in the vbs and have some test code for this, but am not sure how to implement. I would like help w/ both these issues, but want to start small with macro1.

Expert:  Richard replied 1 year ago.
You cannot run the Macro from Autoexec, you run it from the VBS script.

So, rename the Sub in the Excel from Autoexec to

public sub sendK()

Then use this code in the VBS (I am assuming you still have it in c:\testt



Set xl = CreateObject("Excel.application")

xl.Application.Workbooks.Open "c:\testt\test.xlsm"
xl.Application.Visible = True
xl.Application.run "'c:\testt\test.xlsm'!sendK"

Set xl = Nothing

It then runs.

Let me know the results please

Thank you
Customer: replied 1 year ago.

macro1 is not located in the autoexec. It is a stand alone. It just doesn't run properly. Can you run this vbs/bat with text.xlsm to see if it runs for you. It sees to disable.

Expert:  Richard replied 1 year ago.
yes, it will also run correctly (message box Hi)

Use this code in the VBS file.



Set xl = CreateObject("Excel.application")

xl.Application.Workbooks.Open "c:\testt\test.xlsm"
xl.Application.Visible = True
xl.Application.run "'c:\testt\test.xlsm'!Macro1"

Set xl = Nothing

Customer: replied 1 year ago.

Wait, the macro we are looking at is Macrotest, not the macro1.


Look at that one

Expert:  Richard replied 1 year ago.
Also works,

Any will work Marilyn, as long as you update the VBS file.

For example, to run MacroTest you put in MacroTest on the second last line

Like below


Set xl = CreateObject("Excel.application")

xl.Application.Workbooks.Open "c:\testt\test.xlsm"
xl.Application.Visible = True
xl.Application.run "'c:\testt\test.xlsm'!MacroTest"

Set xl = Nothing


You see xl.Application.run "'c:\testt\test.xlsm'!MacroTest"

Thats the bit that runs the Macro on open.

Customer: replied 1 year ago.

Did you actually run it to verify?


 


The other piece to my question is that I my macro will be using an addin (PDFMaker) . and it said something about addins need to be opened via the vbs code as a step after the Create Object so I needed you to help me with this additional code.


 


This looks like my add-in C:\Program Files (x86)\Adobe\Acrobat 11.0\PDFMaker\Office\PDFMOfficeAddin.dll

Expert:  Richard replied 1 year ago.
Yes I do,

I have run it succesfully every time you have asked.

Why, is it not working for you?


The code you need to enable the Add in for the PDFMaker is

XL.AddIns("Add In Name").Installed = True

You need to replace Add in Name with the name if the Add in.

So your VBS would be

Set xl = CreateObject("Excel.application")

xl.Application.Workbooks.Open "c:\testt\test.xlsm"
xl.Application.Visible = True
XL.AddIns("Add In Name").Installed = True
xl.Application.run "'c:\testt\test.xlsm'!MacroTest"

Set xl = Nothing


Then the Macro can use the Add in.
Customer: replied 1 year ago.

Interesting. What version of Excel and Windows are you running this on? Sounds like the first part should work. I wonder why it doesn't.. I've been running this over and over with no luck.


 


In the Addin name, do you think I would put "C:\Program Files (x86)\Adobe\Acrobat 11.0\PDFMaker\Office\PDFMOfficeAddin.dll" in that? Also, have you heard of an addin ending in dll. This is what I saw when I looked in Excel on the PDFMaker addin.

Expert:  Richard replied 1 year ago.
Windows 7 and Excel 2010 but this works on all versions of excel.

Are you using my code for the VBS?

The addin name will be the actual name listed in the adding in Excel.

From what you are saying this looks to be PDFMaker, but check in Addins in Excel to get its name. It is not the DLL name, that is the actual add in file.

Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 16842
Experience: Over 15 year experience resolving Microsoft Office Issues
Richard and 4 other Microsoft Office Specialists are ready to help you
Customer: replied 1 year ago.

Hum, that is the versions of both that I have. Is there anyway that you can connect to my machine so you can see.


 


I am using the exact code we worked on.


 


I did a google on PDFMaker.xla which does exists. Maybe that could be the one?

Expert:  Richard replied 1 year ago.

Go to Click Me

Click START MEETING

It will download a program to your computer

Run the program by double clicking it, and it will give you a set of 9 numbers

Give me the numbers at the top of the screen (eg: 456-789-123) in your message to me here please

Thank you
Customer: replied 1 year ago.

507-586-001

Expert:  Richard replied 1 year ago.
Logging on
Expert:  Richard replied 1 year ago.
Fixed!
Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 16842
Experience: Over 15 year experience resolving Microsoft Office Issues
Richard and 4 other Microsoft Office Specialists are ready to help you

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
< Last | Next >
  • http://ww2.justanswer.com/uploads/JS/jstinehelfer/2012-6-6_215146_Pictureofme1.64x64.png jstinehelfer's Avatar

    jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
  • http://ww2.justanswer.com/uploads/JA/JasonJames122/2011-12-16_135647_jasonjamesheadshotweb.64x64.jpg JasonJames122's Avatar

    JasonJames122

    Computer Enthusiast

    Satisfied Customers:

    0
    I manage all information systems (network of Windows PC's and servers with Microsoft Office products) for a small business
  • http://ww2.justanswer.com/uploads/JE/jessmagz/2012-6-6_18129_jm.64x64.jpg Jess M.'s Avatar

    Jess M.

    Computer Support Specialist

    Satisfied Customers:

    301
    Computer Software Specialist for more than 10 years
  • http://ww2.justanswer.com/uploads/CH/chutz747/2011-11-6_14231_me.64x64.jpg The-PC-Guy's Avatar

    The-PC-Guy

    Computer Manager

    Satisfied Customers:

    274
    20 years experience providing remote computer support
  • http://ww2.justanswer.com/uploads/SP/spherrod/2012-6-6_174244_1000852.64x64.JPG Steve Herrod's Avatar

    Steve Herrod

    Computer Support Specialist

    Satisfied Customers:

    125
    Trained in Microsoft Office from 2000 through to latest version 2010.
  • http://ww2.justanswer.com/uploads/SE/Seashore2011/2011-12-6_33418_111205223015.64x64.jpg Chris L.'s Avatar

    Chris L.

    Support Specialist

    Satisfied Customers:

    124
    Certified Expert with over 10 years experience.
  • http://ww2.justanswer.com/uploads/KR/krkljatorm/2012-6-24_153417_ITMiro.64x64.jpg IT Miro's Avatar

    IT Miro

    Computer Scientist

    Satisfied Customers:

    97
    Bachelor's Degree in Information Technology, Microsoft Certified Professional
 
 
 
Chat Now With A Microsoft Office Technician
Richard
Richard
IT Manager
902 Satisfied Customers
Over 15 year experience resolving Microsoft Office Issues