• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

How to fix this problem on Attachments.Add|VBA & Macros|Excel Forum|My Online Training Hub

You are here: Home / How to fix this problem on Attachments.Add|VBA & Macros|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumVBA & MacrosHow to fix this problem on Attachme…
sp_PrintTopic sp_TopicIcon
How to fix this problem on Attachments.Add
Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
1
April 18, 2021 - 8:26 pm
sp_Permalink sp_Print

Hello everyone my name is Maurizio and my problem is this:
On Excel Sheet 1 I have inserted all the items that a Routine that Opens the E-Mail Sheet runs
Both Outlook and Thurderbird
2) But since I was also trying to insert a code to Attach a file that is in my sub-working folder; This Code keeps telling me error and I don't understand why
Thanks for all the help you want to give me on this.
Greetings from Maurizio

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
2
April 19, 2021 - 1:13 pm
sp_Permalink sp_Print

Hi Maurizio (by the way: we all know your name is Maurizio, after 159 posts 🙂 )

Attachments.Add is an Outlook instruction, it simply cannot be used in a command line.

Use:

strCommand = strCommand & " -compose " & _
"to=" & Foglio1.Cells(1, 7).Value & _
",subject=" & Foglio1.Cells(4, 1).Value & _
",body=" & Foglio1.Cells(5, 1).Value & strBody & _
",attachment=" & ThisWorkbook.Path & "\Utility\" & sAllegato & ".pdf"

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
3
April 19, 2021 - 8:02 pm
sp_Permalink sp_Print

Hello Catalin Bombea
Thanks Of The Suggestion
I thought I was welcome to show up all the time
But that's okay
From now on I will no longer put my name; But I'll move on to the request right away.

Thanks also for your Practical Tip.
But in seeing it, an almost spontaneous question arises which is this:
At the end, you write (& s Attachment & ".pdf")
But then if I remove the Mormato (PDF) and insert the Format (XLSM or DOTX)
Would the Program attach one of these formats to me?
Thanks for your suggestions
Greetings from Maurizio

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4449
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
April 19, 2021 - 8:56 pm
sp_Permalink sp_Print

Hi Maurizio,

Catalin wasn't saying you weren't welcome, simply that we know who you are so you can skip the introduction.

Mynda

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
5
April 20, 2021 - 12:21 am
sp_Permalink sp_Print

Hi Maurizio,
Your profile is next to ALL your messages, saying your name when the profile is next to your message is redundant.

You're welcome anytime.

In your sample files, you have pdf files with names like: 1.pdf2.pdf

In the sAllegato range, you have only 1.pdf2, NOT providing the file EXTENSION, which is very important, the file name is NOT complete without the extension. That is the reason why I added the extension after the string.

Of course, if you put the complete file name AND extension in the cell, you can remove the extension from code.

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
6
April 20, 2021 - 2:35 am
sp_Permalink sp_Print

Hi Mynda Treacy and Catalin Bombea
I state that here you could only expect the best of instructions, even of a personal nature.

You are both awesome now I understand how to fix this technical font.

One last question, however, I would always like to ask that it is possible.
And this is it: has it ever happened to you that the day before, working on modules, you found everything you are interested in obtaining
Everything pergetta, emte Working
Therefore, having saved everything, go away satisfied
And the day when you reopen everything you see something like this?

Image Enlarger

Image Enlarger

And the great thing is that now not only does he not let me see the code anymore, Cresh also goes and restarts the program
In your opinion, there is a way to return to normal thanks

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
7
April 20, 2021 - 3:35 am
sp_Permalink sp_Print

"I state that here you could only expect the best of instructions, even of a personal nature."

Can you please use google translate? What does this even mean? 
Your personal english is so different than the english language...
We do not request personal information at all.

On any forum around the world, if you hope to receive an answer, it is recommended to provide as clear instructions as possible, otherwise there is a high chance that nobody will answer.

Here is what you have said:
[Premetto che qui ci si può aspettare solo il meglio delle istruzioni, anche di natura personale. Capisco come correggere questo carattere tecnico. Un'ultima domanda, però, vorrei sempre chiederti che è possibile. Ed è proprio questo: ti è mai successo che il giorno prima, lavorando sui moduli, hai trovato tutto quello che ti interessava ottenere Tutto pergetta, emte Funzionante Quindi, avendo salvato tutto, vai via soddisfatto]

https://translate.google.it/

I have seen such vba project corruption before.

Make a copy of the file in a different location, rename the file. When you open this copy of the file, DO NOT ENABLE macros. This will allow you to see the VB project.

Make a small change in code: add a simple space somewhere, or add a blank new line, any change will do the trick.

Save the changes, next time you open the file will work.

Auguri

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
8
April 20, 2021 - 3:50 am
sp_Permalink sp_Print

Hello Catalin Bombea
The speech is very simple
Google as a translator is leaking everywhere.
But my problem is that yesterday while I was waiting for your intervention (Response) regarding my request
I was able to get this to work using a little bit of code fantasy.
And as long as I had my project open, things all worked out wonderfully.
Today I tried to reopen my project To want to embed your suggestion inside it too.
But what appears to me now are only those two written ones and it no longer lets me enter anywhere to see the code; That's all

Avatar
Catalin Bombea
Iasi, Romania
Admin
Level 10
Forum Posts: 1810
Member Since:
November 8, 2013
sp_UserOfflineSmall Offline
9
April 20, 2021 - 4:07 am
sp_Permalink sp_Print

Google might be leaking, but I can't understand your english unfortunately, total nonsense.

I provided a fix, let us know if works for you.

Avatar
A.Maurizio
Member
Members
Level 0
Forum Posts: 202
Member Since:
June 26, 2016
sp_UserOfflineSmall Offline
10
April 20, 2021 - 4:34 am
sp_Permalink sp_Print

OK thanks

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Velouria, Nada Perovic, Denise Lloyd
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
A.Maurizio: 202
Jessica Stewart: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Raj Mattoo
Mark Luke
terimeri dooriyan
Jack Aston
AndyC
Denise Lloyd
michael serna
mashal sana
Tiffany Kang
Leah Gillmore
Forum Stats:
Groups: 3
Forums: 24
Topics: 6219
Posts: 27276

 

Member Stats:
Guest Posters: 49
Members: 31903
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.